
我想控制按钮的大小,我使用方法setBounds但是没有变化,这是我的代码
public class levels extends JFrame implements ActionListener{
//Variables
private static JLabel chooseLevel;
private static JButton easyPuzzle;
private static JButton mediumPuzzle;
private static JButton hardPuzzle;
// End Of Variables
Run Code Online (Sandbox Code Playgroud)
这主鳕鱼
public static void main(String[]args){
levels level = new levels();
level.setBounds(400, 190, 450, 450);
level.setVisible(true); // frame is visible
level.setResizable(false); // not Resizable frame
level.setTitle("Puzzle Number : New Game"); // Title Of the frame
Run Code Online (Sandbox Code Playgroud)
容器添加组件
Container cN = level.getContentPane(); // Container to add components for farme 1
GridLayout gN = new …Run Code Online (Sandbox Code Playgroud)