Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. package Szavazat;
  2.  
  3. import java.awt.FlowLayout;
  4. import java.awt.GridLayout;
  5. import java.awt.HeadlessException;
  6. import javax.swing.JButton;
  7. import javax.swing.JCheckBox;
  8. import javax.swing.JFrame;
  9. import javax.swing.JLabel;
  10. import javax.swing.JPanel;
  11. import javax.swing.JTextField;
  12.  
  13. /**
  14. *
  15. * @author Strigo
  16. */
  17. public class Keret extends JFrame{
  18.  
  19. private JLabel lb1;
  20. private JLabel lb2;
  21. private JLabel lb3;
  22.  
  23. private JButton bt;
  24.  
  25. private JTextField t1;
  26. private JTextField t2;
  27.  
  28. private JCheckBox j1;
  29.  
  30. private JPanel p1;
  31. private JLabel p2;
  32. private JPanel p3;
  33. private JPanel p4;
  34. private JPanel p5;
  35.  
  36.  
  37.  
  38. public Keret() throws HeadlessException {
  39.  
  40. super("Szavazat");
  41. setVisible(true);
  42. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  43.  
  44.  
  45. this.bt= new JButton("Vote");
  46. this.lb1=new JLabel("Szavazat");
  47. this.lb2=new JLabel("Kérem pipálja be a jelölő négyzetet");
  48. this.lb2=new JLabel();
  49. this.t1= new JTextField("proba", 10);
  50. this.t2= new JTextField(10);
  51. this.j1= new JCheckBox();
  52. this.p1=new JPanel();
  53. this.p2=new JLabel();
  54. this.p3=new JPanel();
  55. this.p4=new JPanel();
  56. this.p5=new JPanel();
  57.  
  58.  
  59.  
  60.  
  61. /**
  62. * Elrendezi az objektumokat, egy sorban folytonosan.
  63. */
  64.  
  65. FlowLayout f1= new FlowLayout(1);
  66. setLayout(f1);
  67.  
  68.  
  69. GridLayout gr= new GridLayout(2,1);
  70. setLayout(gr);
  71.  
  72.  
  73.  
  74.  
  75.  
  76. /** Hozzáadja a gombokat.
  77. *
  78. */
  79. p1.add(lb1);
  80. p1.add(t1);
  81. p2.add(lb2);
  82. //p2.add(t2);
  83. p3.add(bt);
  84. //p4.add(lb3);
  85. p5.add(j1);
  86. this.add(p1);
  87. this.add(p2);
  88. this.add(p3);
  89. this.add(p4);
  90. this.add(p5);
  91.  
  92. /* Egy panelnek is meg lehet adni elrendezéskezelőt.
  93. GridLayout gr2= new GridLayout(2,1);
  94. p1.setLayout(gr2);
  95.  
  96. */
  97.  
  98. /**
  99. * Átméretezi a keretet.
  100. */
  101. pack();
  102.  
  103.  
  104.  
  105. }
  106.  
  107.  
  108.  
  109.  
  110.  
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement