import java.awt.*;
import javax.swing.*;
public class JFrameExample {
public static void main(String[] args) {
JFrame f = new JFrame("This is a test");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(400, 150);
Container content = f.getContentPane();
content.setBackground(Color.blue);
content.setLayout(new FlowLayout());
JLabel la = new JLabel("Name");
content.add(la);
JButton b1 = new JButton("Ok");
content.add(b1);
content.add(new JButton("Button 1"));
content.add(new JButton("Button 2"));
content.add(new JButton("Button 3"));
f.setVisible(true);
}
}
0 comments: