Crenox

Sam GUI #1

Mar 24th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. package com.samkough.main;
  2.  
  3. import javax.swing.*;
  4. import java.awt.*;
  5.  
  6. @SuppressWarnings("serial")
  7. public class Sam extends JFrame
  8. {
  9. public static int WIDTH = 600;
  10. public static int HEIGHT = 600;
  11.  
  12. private JLabel l1;
  13. private JButton b1;
  14. private JTextField tf1;
  15. private JRadioButton rb1;
  16. private JCheckBox cb1;
  17. private JMenuItem mi1;
  18.  
  19. public static void main(String args[])
  20. {
  21. Sam frame = new Sam();
  22.  
  23. frame.setVisible(true);
  24. frame.setTitle("Sam");
  25. frame.setSize(WIDTH, HEIGHT);
  26. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  27. frame.setLocationRelativeTo(null);
  28. }
  29.  
  30. public Sam()
  31. {
  32. setLayout(new FlowLayout());
  33.  
  34. l1 = new JLabel("This is label");
  35. b1 = new JButton("This is button");
  36. tf1 = new JTextField("This is text field");
  37. rb1 = new JRadioButton("This is radio button");
  38. cb1 = new JCheckBox("This is check box");
  39. mi1 = new JMenuItem("This is menu item");
  40.  
  41. add(l1);
  42. add(b1);
  43. add(tf1);
  44. add(rb1);
  45. add(cb1);
  46. add(mi1);
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment