Advertisement
Guest User

Pane

a guest
Dec 8th, 2011
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. import java.awt.BorderLayout;
  2.  
  3.  
  4. public class MainWindow extends JFrame {
  5.  
  6. private JPanel contentPane;
  7.  
  8. /**
  9. * Launch the application.
  10. */
  11. public static void main(String[] args) {
  12. EventQueue.invokeLater(new Runnable() {
  13. public void run() {
  14. try {
  15. MainWindow frame = new MainWindow();
  16. frame.setVisible(true);
  17. } catch (Exception e) {
  18. e.printStackTrace();
  19. }
  20. }
  21. });
  22. }
  23.  
  24. /**
  25. * Create the frame.
  26. */
  27. public MainWindow() {
  28. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  29. setBounds(100, 100, 450, 300);
  30. contentPane = new JPanel();
  31. contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  32. setContentPane(contentPane);
  33. contentPane.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
  34.  
  35. JPanel panel = new JPanel();
  36. contentPane.add(panel);
  37.  
  38. JButton btnNewButton_1 = new JButton("New button");
  39. panel.add(btnNewButton_1);
  40.  
  41. JButton btnNewButton_2 = new JButton("New button");
  42. panel.add(btnNewButton_2);
  43.  
  44. JButton btnNewButton = new JButton("New button");
  45. panel.add(btnNewButton);
  46. }
  47.  
  48. }
  49.  
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement