我将它设置为可见,做所有需要做的事情,例如大小和布局,当我点击运行时它不会显示。有谁知道为什么?我看过我过去做过的其他视图类,没有看到任何不同
package model;
import java.awt.*;
import javax.swing.*;
import java.lang.reflect.Method;
@SuppressWarnings("serial")
public class View extends JFrame {
private static final int FRAME_WIDTH = 1000;
private static final int FRAME_HEIGHT = 800;
private static final int FRAME_X_ORIGIN = 250;
private static final int FRAME_Y_ORIGIN = 250;
private JButton solveButton;
private static Controller myController;
public View(Controller controller)
{
myController = controller;
this.setVisible(true);
this.setLayout(null);
this.setSize(FRAME_X_ORIGIN, FRAME_Y_ORIGIN);
Container contentPane;
this.setTitle("NQueens");
this.setResizable(false);
this.setBackground(Color.WHITE);
solveButton = new JButton("Solve");
solveButton.setBounds(500,460,80,80);
this.add(solveButton);
this.setVisible(true);
}
}