Guest User

Untitled

a guest
Dec 13th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package piatek2;
  7.  
  8. import java.awt.BorderLayout;
  9. import java.awt.CardLayout;
  10. import java.awt.FlowLayout;
  11. import java.awt.GridLayout;
  12. import javax.swing.JButton;
  13. import javax.swing.JFrame;
  14. import static javax.swing.JFrame.EXIT_ON_CLOSE;
  15. import javax.swing.JPanel;
  16. import javax.swing.WindowConstants;
  17. import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
  18. import static javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE;
  19. import static javax.swing.WindowConstants.HIDE_ON_CLOSE;
  20.  
  21. /**
  22. *
  23. * @author nowak_000
  24. */
  25. public class Piatek2 {
  26.  
  27. /**
  28. * @param args the command line arguments
  29. */
  30. public static void main(String[] args) {
  31. // TODO code application logic here
  32. java.awt.EventQueue.invokeLater(new Runnable() {
  33. public void run() {
  34. JFrame frame = new JFrame();
  35. //JPanel panel = new JPanel(new FlowLayout());
  36. //JPanel panel = new JPanel(new BorderLayout());
  37. JPanel panel = new JPanel(new GridLayout());
  38.  
  39. //JPanel panel = new JPanel(new CardLayout());
  40. JButton[] tab = new JButton[10];
  41. for (int i = 0; i < 10; i++) {
  42. tab[i] = new JButton();
  43. tab[i].setText(String.valueOf(i));
  44. panel.add(tab[i]);
  45. }
  46. frame.add(panel);
  47. frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
  48. frame.setSize(200, 500);
  49. frame.setResizable(false);
  50. frame.setVisible(true);
  51.  
  52. }
  53. });
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment