Guide to Object-oriented Programming With Java (Buffalo State College Version)
Chapter 16: Using java.awt and javax.swing to Create GUI Applications
Up to this point, the Java programs have accepted input from and written output to the Eclipse Console window. Java provides a number or robust libraries for creating Graphical User Interfaces (GUIs). These include the java.awt.*, javax.swing.*, javafx.*, org.eclipse.swt.* libraries.
Java GUI Basic Concepts
Before you can begin creating a Java GUI application you need to understand a few basic GUI concepts, such as frames, components (fields, labels, etc.), panels, layout managers, and coordinates:
Adding WindowBuilder and Swing Your Eclipse Project
Before you can run a GUI Java program you need to follow these steps to add Swing and WindowBuilder to Eclipse.
Steps to add Swing to Eclipse
Steps to add WindowBuilder to Eclipse
The java.awt and java.swing Libraries
To create a Java GUI application using the java.awt and java.swing libraries you first need to import the packages you need from each of them. Then you can add a layout (in this example BorderLayout) and components. Finally, you need to add the panes to the frame and make the frame using frame.setVisable(true). This creates the pop-up GUI application.
Here is a list of Java background and foreground colors.