站内搜索: 请输入搜索关键词

当前页面: 开发资料首页Java 专题多屏幕

多屏幕

摘要: 多屏幕

</td> </tr> <tr> <td width="482" height="35" valign="top" class="ArticleTeitle"> 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 GraphicsDevice gd=gdArray[i];
GraphicsConfiguration gcArray[]=gd.getConfigurations();
System.out.println(gcArray.length+" ");
for(int j=0;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);
}
}
</td> <td width="202" valign="top" class="ArticleTeitle">
</td> </tr> <tr> <td height="25" colspan="2" valign="top" class="ArticleTeitle">


↑返回目录
前一篇: 由域名地址求IP
后一篇: 将一个大图像分割成小图像