In this section, you'll learn how to create graphical user interfaces (GUIs) using AWT (Abstract Window Toolkit) and Swing. AWT provides basic building blocks for creating windows, while Swing extends AWT to provide more advanced features and components.
- AWT Basics - Creating simple applets and handling user input.
- Swing Basics - Creating windows, adding controls, and handling events.
- Layouts - Managing component positioning with different layout managers like
BorderLayout
. - RGB Colors - Working with colors using scroll bars.
-
LoginApplet.java
- An applet that creates a simple login window with username and password fields.- Concepts: Using
TextField
andButton
in an applet.
- Concepts: Using
-
FontApplet.java
- A program that lets the user change the font of text using control boxes for font name, size, and style.- Concepts: Working with
Choice
boxes and font manipulation.
- Concepts: Working with
-
CalculatorApplet.java
- A 3-function calculator (addition, subtraction, multiplication) implemented as an applet.- Concepts: Handling button click events in applets.
-
RGBApplet.java
- A program that uses scrollbars to adjust RGB color combinations and change the background color.- Concepts: Working with
Scrollbar
andColor
in applets.
- Concepts: Working with
-
SwingLogin.java
- A Swing version of the login window with username and password fields.- Concepts: Using
JTextField
andJButton
in Swing.
- Concepts: Using
-
SwingFont.java
- A Swing application that lets the user change the font of the text using control boxes.- Concepts: Handling events and changing styles in Swing.
-
SwingCalculator.java
- A 3-function calculator created using Swing components.- Concepts: Handling basic arithmetic operations with
JButton
andJTextField
.
- Concepts: Handling basic arithmetic operations with
-
SwingRGB.java
- A program that uses scrollbars in Swing to display color combinations of RGB values.- Concepts: Handling
JScrollBar
events in Swing.
- Concepts: Handling
-
SwingBorderLayout.java
- A demonstration of using theBorderLayout
layout manager in Swing.- Concepts: Arranging components with
BorderLayout
.
- Concepts: Arranging components with
- Create a simple login applet that checks if the username and password match predefined values.
- Write an applet that uses scrollbars to change the background color of the window.
- Create a Swing application with three control boxes to select a font, size, and style, and apply the selected settings to a text label.
- Write a Swing application that uses at least five different controls, such as buttons, text fields, checkboxes, etc.
After learning AWT and Swing basics, you can dive into more advanced topics like custom painting, event-driven programming, and integrating GUI with backend data using JDBC.
- CalculatorApplet.java: Implements a 3-function calculator using applet.
- LoginApplet.java: Applet login window with text fields and buttons.
- FontApplet.java: Applet with control boxes for font name, size, and style.
- RGBApplet.java: Applet to display RGB combination using scrollbars.
- SwingControls.java: Swing application using at least 5 controls.
- BorderLayoutApplet.java: Implements border layout using applet.
- SwingCalculator.java: Implements a 3-function calculator using Swing.
- SwingLogin.java: Swing login window with text fields and buttons.
- SwingFont.java: Swing application with control boxes for font name, size, and style.
- SwingRGB.java: Swing application to display RGB combination using scrollbars.
- SwingBorderLayout.java: Implements border layout using Swing.