我的jframe没有显示 [英] My jframe doesn't shows

查看:143
本文介绍了我的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没有显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆