Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- import java.awt.FlowLayout;
- import java.awt.GridLayout;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- class App {
- public static void main(String[] args)
- {
- int num = 15;
- GridLayout experimentLayout = new GridLayout(0, 3);
- JFrame f=new JFrame();//creating instance of JFrame
- f.setSize(400,500);//400 width and 500 height
- f.setLayout(experimentLayout);
- for(int i=1; i<=num; i++) {
- f.add(new JButton("Button "+i));
- }
- f.setVisible(true);//making the frame visible
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement