📄 multiplescreendemo2.java
字号:
// MultipleScreenDemo2.java
import java.awt.*;
import java.awt.event.*;
class MultipleScreenDemo2
{
public static void main (String [] args)
{
GraphicsEnvironment ge;
ge = GraphicsEnvironment.getLocalGraphicsEnvironment ();
GraphicsDevice [] gdArray = ge.getScreenDevices ();
for (int i = 0; i < gdArray.length; i++)
{
GraphicsDevice gd = gdArray [i];
GraphicsConfiguration [] gcArray = gd.getConfigurations ();
for (int j = 0; j < gcArray.length; j++)
{
Frame f = new Frame (gdArray [i].
getDefaultConfiguration ());
Rectangle bounds = gcArray [j].getBounds ();
int xoffset = bounds.x;
int yoffset = bounds.y;
f.addWindowListener (new wClose ());
f.setTitle ("Screen "+ Integer.toString (i)
+ ", GC# " + Integer.toString (j));
f.setSize (200, 200);
f.setLocation ((j * 50) + xoffset, (j * 60) + yoffset);
f.setVisible (true);
}
}
}
}
class wClose extends WindowAdapter
{
public void windowClosing (WindowEvent e)
{
System.exit (0);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -