我的Java应用程序的片段:
JFrame f = new JFrame();
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
gd.setFullScreenWindow(f);
Run Code Online (Sandbox Code Playgroud)
所以它的作用是让它自动全屏.现在奇怪的是程序是全屏的,但只能在一台显示器上!例如,我有一个带有两个屏幕的Windows Vista系统,它们组合在一个桌面上.怎么做才能让它全屏显示所有显示器?
好的我试过了:
import java.awt.image.ColorModel;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;
class grdevs
{
public static void main(String [] args)
{
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
for(GraphicsDevice curGs : gs)
{
GraphicsConfiguration[] gc = curGs.getConfigurations();
for(GraphicsConfiguration curGc : gc)
{
Rectangle bounds = curGc.getBounds();
ColorModel cm = curGc.getColorModel();
System.out.println("" + bounds.getX() + "," + bounds.getY() + " " + bounds.getWidth() …Run Code Online (Sandbox Code Playgroud)