Creating GUI (graphic interface) with Swing API in Java. Part 2

Hierarchy Swing Class A common GUI will have three elements: A container class (JFrame, JDialog, JApplet) Components of the graphical user interface (buttons, labels, text fields, etc.). Elements for event management. A GUI application is developed on a framework, the JFrame class, and various components of the interface will be placed. Constructors JFrame(String title). Constructor… Read More »

JRootPane

A root panel is divided into four parts. Glass Panel Hidden by default. If it becomes visible, it’s like a sheet of glass on the other parts of the root panel went down. It is completely transparent (unless we make the paint method do something) and intercepts input events for the root pane. The layers… Read More »

BoxLayout

BoxLayout allows you to put the components horizontally or vertically. Example: import java.awt.Component; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.WindowConstants; public class ExampleBoxLayout { public static void main(String [] args) { //JFrame create one new window JFrame v = new JFrame(); //getContentPane() is usually placed in the components v.getContentPane().setLayout(new BoxLayout(v.getContentPane(),BoxLayout.Y_AXIS)); //JButton create… Read More »