My jframe doesn't shows [closed]

允我心安 提交于 2019-12-02 23:53:02

问题


I'm beginner woth java programming

I tried to make my jframe shows but it didn't

jframe.setVisible(true);

it doesn't works


回答1:


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);
}


来源:https://stackoverflow.com/questions/15260062/my-jframe-doesnt-shows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!