Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. super("Simple Submit Cancel Form"); //Create JFrame with title.
  2.  
  3. this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  4. this.setResizable(false);
  5. this.setSize(300,100); //300*100 pixels.
  6.  
  7. Container pane = this.getContentPane();
  8. pane.setLayout(new GridLayout(2,1)); //Give the pane two rows and one collumn.
  9.  
  10.  
  11. JPanel textPane = new JPanel(); //Create a smaller pane to hold the buttons.
  12. JTextField textField = new JTextField("",23);
  13. textPane.add(textField); //Add the textfield to the textPane.
  14. pane.add(textPane);
  15.  
  16. JPanel buttonPane = new JPanel(); //Create a smaller pane to hold the buttons.
  17. JButton submitButton = new JButton("Submit");
  18. JButton cancelButton = new JButton("Cancel");
  19. buttonPane.add(submitButton); //Add buttons to the buttonPane.
  20. buttonPane.add(cancelButton);
  21. pane.add(buttonPane); //Add buttonPane to the pane.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement