Java Lesson 14-1
Java Lesson 14-1
Objects
AWT Swing
JLabel JTextField
JCheckBox
JFrame
JButton
• import javax.swing.*;
• public class JFrameSubclass extends JFrame {
• public JFrameSubclass() {
• setTitle("First GUI Program");
• setSize(300, 200);
• setLocation(150, 250);
• setVisible(true);
• setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
• }
• In Java Swing, the layer that is used to hold objects is called content pane.
• GUI objects such as buttons, labels, textboxes are added to the content pane layer
of the container.
• getContentPane() method retrieves the content pane layer so that you can add
an object to it.
• Layout Manager
• FlowLayout
• BorderLayout
• GridLayout
• Absolute Positioning