public class FullScreenFrameTest extends JFrame {
public FullScreenFrameTest() {
super();
initFrame();
setVisible(true);
//full screen
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice device = env.getDefaultScreenDevice();
device.setFullScreenWindow(this);
//end full screen
}
public void initFrame() {
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setUndecorated(true);
setLocation(0, 0); //tried removing this, still doesn't work
setSize(screen.width, screen.height);
}
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
}
new FullScreenFrameTest();
}
}
문제는 가끔이 작업을 수행한다는 것입니다 때로는 특히 우분투,하지 않는 나는 기본적으로 새로운 JFrame의를 초기화하고 그것을 전체 화면으로 설정이 코드를 가지고 : 때로는 전체 화면을 볼 때로는 두 개의 막대가 표시됩니다. 나는 무엇을 놓치고 있습니까?
UPDATE
은 스크린 샷이 있습니다 :
['invokeLater()'] (http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html)? –
1) EDT에서 자바 GUI를 생성하고 업데이트해야합니다. 자세한 내용은 [동시성의 동시성] (http://docs.oracle.com/javase/tutorial/uiswing/concurrency/)을 참조하십시오. 2) ['Frame.setExtendedState (int)'] (http://docs.oracle.com/javase/7/docs/api/java/awt/Frame.html#setExtendedState%28int%29)도 참조하십시오. –
@CatalinaIsland 정말 고마워! – BackSlash