Slide 17
Slide 17 text
import javax.swing.*;
public class Example extends JFrame{
public Example() {
super("Hello World Swing");
BorderLayout layout = new BorderLayout();
setLayout(layout);
JLabel label = new JLabel("Hello World");
add(label, BorderLayout.CENTER);
JButton button = new JButton("Click Me");
add(button , BorderLayout.SOUTH);
JTextField text = new JTextField("Text", 10);
add(text , BorderLayout.NORTH);
JCheckBox check = new JCheckBox("Option");
add(check , BorderLayout.EAST);
}
public static void main(String[] args) {
Example frame = new Example();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(500,500);
frame.setVisible(true); }
}