📄 guiscreens.java
字号:
// GuiScreens.java// A quick utility to print out graphic device information. Will work on// systems with multiple monitors.//package jswing.ch03;import java.awt.*;import javax.swing.*;public class GuiScreens { public static void main(String[] args) { Rectangle virtualBounds = new Rectangle(); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gs = ge.getScreenDevices(); JFrame frame[][] = new JFrame[gs.length][]; for (int j = 0; j < gs.length; j++) { GraphicsDevice gd = gs[j]; System.out.println("Device " + j + ": " + gd); GraphicsConfiguration[] gc = gd.getConfigurations(); frame[j] = new JFrame[gc.length]; for (int i=0; i < gc.length; i++) { System.out.println(" Configuration " + i + ": " + gc[i]); System.out.println(" Bounds: " + gc[i].getBounds()); virtualBounds = virtualBounds.union(gc[i].getBounds()); frame[j][i] = new JFrame("Config: " + i, gc[i]); frame[j][i].setBounds(50, 50, 400, 100); frame[j][i].setLocation( (int)gc[i].getBounds().getX() + 50, (int)gc[i].getBounds().getY() + 50); frame[j][i].getContentPane().add(new JTextArea("Config:\n" + gc[i])); frame[j][i].setVisible(true); } System.out.println("Overall bounds: " + virtualBounds); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -