当我到达“以下是等效的”部分时,我试图展示如何执行vc.setFullScreenWindow(window)
所有命令,但我自己很困惑,因为我对此很陌生。
这是我的主要问题,但如果有人能解释任何值得注意的关于 GraphicsEnvironment 或 JFrame 的内容,我将非常感激。
import java.awt.*;
import javax.swing.JFrame;
// Screens2 can use all methods that JFrame has
public class Screens2 extends JFrame{
// Video Card used for Utilizing the graphics on the computer SCREEN
private GraphicsDevice vc;
// The Constructor merely sets the default Screen graphics up
public Screens2(){
// The OS specific Graphics Envirionment
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
// Graphics Device vc = The Default();
vc = env.getDefaultScreenDevice();
}
// he DisplayMode class encapsulates the bit depth,
// height, width, and refresh rate of a GraphicsDevice.
// this method also takes in a JFrame to Display the DisplayMode
public void setFullScree(DisplayMode dm, JFrame window){
// Nothing fancy
window.setUndecorated(true);
window.setResizable(false);
// The following is equivalent =======================================================
private GraphicsDevice.GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(window);
vc.setFullScreenWindow(window);
}
}