我的jframe没有显示

我是java初学者

我试图制作我的jframe节目,但事实并非如此

jframe.setVisible(true); 

它不起作用

我认为您没有正确声明您的JFrame。 以下是创建简单框架的示例:

 public static void main(String[] args) { // Creating a frame JFrame frame = new JFrame("Example"); // Setting the position and the size of the frame frame.setBounds(0,0,800,600); // This will terminate the program when closing the frame frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Then you can display your frame frame.setVisible(true); }