My code is here:
import javax.swing.*;
import java.awt.*;
public class newGui{
JFrame f;
JPanel p1=new JPanel();
JPanel p2=new JPanel();
JPanel p3=new JPanel();
public static void main(String[]args){
newGui myB=new newGui();
myB.draw();
}
public void draw()
{
f=new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(BorderLayout.NORTH,p1);
p2.setBackground(Color.lightGray);
f.getContentPane().add(BorderLayout.CENTER,p2);
f.getContentPane().add(BorderLayout.SOUTH,p3);
p3.setLayout(new GridLayout(9,9));
for(int j=0;j<9;j++)
for(int i=0;i<9;i++)
{
JButton b=new JButton();
p3.add(B)/>;
}
f.setSize(150,300);
f.setVisible(true);
}
}
But the result is not what I want. I want to make the Center location smaller.(for Minesweeper Game)
What should I do?
(the code is not complete!!!)

New Topic/Question
Reply




MultiQuote



|