Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathGridLayoutPane.java
More file actions
Latest commit
20 lines (17 loc) · 617 Bytes
/
Copy pathGridLayoutPane.java
File metadata and controls
20 lines (17 loc) · 617 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
importjavax.swing.*;
importjava.awt.*;
publicclassGridLayoutPane {
publicstaticvoidmain(String[] args) {
JFrameframe = newJFrame("GridLayoutPane");
JPanelpanel = newJPanel();
panel.setLayout(newGridLayout(0,3,10,10));
panel.setPreferredSize(newDimension(450,150));
frame.getContentPane().add(panel);
//add button to desontrate the layout
for (inti = 1; i<= 12; i++)
panel.add(newJButton("Button #"+i));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
}