Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package piatek2;
- import java.awt.BorderLayout;
- import java.awt.CardLayout;
- import java.awt.FlowLayout;
- import java.awt.GridLayout;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- import static javax.swing.JFrame.EXIT_ON_CLOSE;
- import javax.swing.JPanel;
- import javax.swing.WindowConstants;
- import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
- import static javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE;
- import static javax.swing.WindowConstants.HIDE_ON_CLOSE;
- /**
- *
- * @author nowak_000
- */
- public class Piatek2 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- java.awt.EventQueue.invokeLater(new Runnable() {
- public void run() {
- JFrame frame = new JFrame();
- //JPanel panel = new JPanel(new FlowLayout());
- //JPanel panel = new JPanel(new BorderLayout());
- JPanel panel = new JPanel(new GridLayout());
- //JPanel panel = new JPanel(new CardLayout());
- JButton[] tab = new JButton[10];
- for (int i = 0; i < 10; i++) {
- tab[i] = new JButton();
- tab[i].setText(String.valueOf(i));
- panel.add(tab[i]);
- }
- frame.add(panel);
- frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
- frame.setSize(200, 500);
- frame.setResizable(false);
- frame.setVisible(true);
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment