My jframe doesn#39;t shows(我的 jframe 不显示)
本文介绍了我的 jframe 不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是java编程的初学者
I'm beginner woth java programming
我试图让我的 jframe 显示,但它没有
I tried to make my jframe shows but it didn't
jframe.setVisible(true);
没用
推荐答案
我认为你没有正确声明你的 JFrame.这是一个创建简单框架的示例:
I think you didn't declare correctly your JFrame. Here is an example creating a simple frame :
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 不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
织梦狗教程
本文标题为:我的 jframe 不显示
基础教程推荐
猜你喜欢
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 修改 void 函数的输入参数,然后读取 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
