⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fullscreentest.java

📁 java+sql 图书管理系统
💻 JAVA
字号:
package MyLibraryok.MySwing;


/**
 * GraphicsEnvironment为Java应用程序提供了特定平台的 GraphicsDevice对象和 Font
*  对象集合。这些GraphicsDevice可以是各种本机和远端机器的资源,如屏幕、打印机或者是
* Image Buffer,甚至是Graphics2D绘图方法的目标对象。
   而GraphicsDevice就是指特定的图形环境了,如屏幕和打印设备等。这样,我们就可以用
GraphicsDevice来操纵屏幕了。GraphicsDevice提供的setFullScreenWindow()方法就是
设置全屏幕用的。
   由于GraphicsEnvironment的构造器是受保护的(protected),我们不能直接构造一个
GraphicsEnvironment对象来获得GraphicsDevice对象。幸好它提供了
getLocalGraphicsEnvironment()方法,用来获得一个GraphicsEnvironment实例

 */
import java.awt.*;
import java.awt.GraphicsEnvironment;
import javax.swing.JWindow;
import javax.swing.JFrame;

public class FullScreenTest {
  public static void main(String[] args) {

    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    JFrame myWindow = new JFrame();

    if (gd.isFullScreenSupported()) {
      gd.setFullScreenWindow(myWindow);

      System.out.println("size>>>>>>>>" + myWindow.getSize().width);
      System.out.println("aaaaaaaaaaa" + myWindow.getSize().height);
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -