2013-03-06 76 views
-5

我是初學者woth Java編程我的JFrame不顯示

我試圖讓我的JFrame中顯示,但它並沒有

jframe.setVisible(true); 

它不工作

+3

提供完整的程序以獲取清晰的想法 – 2013-03-06 23:15:06

+3

我們需要的不僅僅是這些。考慮發佈[SSCCE](http://sscce.org/) – Reimeus 2013-03-06 23:15:21

+2

這還不夠。我們需要看到一個可以運行的例子,在我們可以幫助您之前,您正在做的事情 – MadProgrammer 2013-03-06 23:15:27

回答

1

我想你沒有正確地聲明你的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); 
} 
+0

謝謝我沒有把第一行 – 2013-03-06 23:30:06