TA的每日心情 | 开心 2021-3-12 23:18 |
---|
签到天数: 2 天 [LV.1]初来乍到
|
import java.awt.*;
import java.awt.event.*;
public class MultipleScreenDemo{
public static void main(String args[]){
GraphicsEnvironment ge;
ge=GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gdArray=ge.getScreenDevices();
System.out.println(gdArray.length+" ");
for(int i=0;i<gdArray.length;i++){
GraphicsDevice gd=gdArray;
GraphicsConfiguration gcArray[]=gd.getConfigurations();
System.out.println(gcArray.length+" ");
for(int j=0;j<gcArray.length;j++){
Frame f=new Frame(gdArray.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);
}
} |
|