Advertisement
LiMIllusion

Untitled

Apr 5th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.awt.*;
  3.  
  4. package seventhlecture;
  5.  
  6. public class Gui {
  7.  
  8. private JFrame f;
  9. private JPanel p;
  10. private JLabel lab;
  11. private JButton b1;
  12.  
  13. public test (){
  14.  
  15. gui ();
  16.  
  17.  
  18. }
  19.  
  20. public void gui(){
  21. f = new JFrame("My frame");
  22. f.setVisible(true);
  23. f.setSize(720, 580);
  24. f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  25.  
  26. p= new JPanel();
  27. p.setBackground(Color.BLUE);
  28.  
  29. b1= new JButton("Click");
  30. lab = new JLabel ("My label");
  31.  
  32. p.add(b1);
  33. p.add(lab);
  34.  
  35. f.add(p);
  36.  
  37. }
  38.  
  39. public static void main(String[] args) {
  40.  
  41. new Gui();
  42.  
  43. }
  44.  
  45. }
  46. import javax.swing.*;
  47. import java.awt.*;
  48.  
  49. package seventhlecture;
  50.  
  51. public class Gui {
  52.  
  53. private JFrame f;
  54. private JPanel p;
  55. private JLabel lab;
  56. private JButton b1;
  57.  
  58. public test (){
  59.  
  60. gui ();
  61.  
  62.  
  63. }
  64.  
  65. public void gui(){
  66. f = new JFrame("My frame");
  67. f.setVisible(true);
  68. f.setSize(720, 580);
  69. f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  70.  
  71. p= new JPanel();
  72. p.setBackground(Color.BLUE);
  73.  
  74. b1= new JButton("Click");
  75. lab = new JLabel ("My label");
  76.  
  77. p.add(b1);
  78. p.add(lab);
  79.  
  80. f.add(p);
  81.  
  82. }
  83.  
  84. public static void main(String[] args) {
  85.  
  86. new Gui();
  87.  
  88. }
  89.  
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement