Java 我的jframe没有';t秀
我是java编程的初学者 我试着制作我的jframe节目,但没有成功Java 我的jframe没有';t秀,java,swing,jframe,Java,Swing,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
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);
}
提供完整的程序以获得清晰的想法。我们需要的不仅仅是这些。考虑一下这是不够的。在我们帮助您之前,我们需要查看您正在做的事情的可运行示例。呃,您没有提供足够的信息<代码>帧设置可见(真)代码>应该有效地显示您的帧,但是您是如何创建/初始化它的,以及在哪里?
jframe
没有在代码中声明。可能就是这样。谢谢,我没放第一行