下面是實現全屏的代碼,簡單明瞭。java
import java.awt.FlowLayout;測試
import javax.swing.JFrame;
import javax.swing.JLabel;get
public class FullScreenTest {
private JFrame jframe;
private JLabel jlabel;
public FullScreenTest(){
jframe = new JFrame();
jlabel = new JLabel();
init();
}
private void init(){
jframe.setTitle("全屏幕測試");
jlabel.setText("如今是全屏模式");
jframe.setUndecorated(true);
jframe.getGraphicsConfiguration().getDevice().setFullScreenWindow(jframe);
jframe.setLayout(new FlowLayout());
jframe.add(jlabel);
}
public void showMe(){
jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jframe.setVisible(true);
}
public static void main(String[] args) {
new FullScreenTest().showMe();
}it
}io