use of java.awt.GraphicsConfiguration in project jdk8u_jdk by JetBrains.
the class MoveToOtherScreenTest method main.
public static void main(String[] args) throws InterruptedException, InvocationTargetException {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gds = ge.getScreenDevices();
if (gds.length < 2) {
System.out.println("Test requires at least 2 displays");
twoDisplays = false;
return;
}
for (int i = 0; i < 2; i++) {
GraphicsConfiguration conf = gds[i].getConfigurations()[0];
JFrame frm = new JFrame("Frame " + i);
// On first screen
frm.setLocation(conf.getBounds().x, 0);
frm.setSize(new Dimension(400, 400));
frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frm.setVisible(true);
frms[i] = frm;
}
canvas.setBackground(Color.red);
frms[0].add(canvas);
}
});
if (!twoDisplays) {
return;
}
Thread.sleep(200);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
frms[1].add(canvas);
}
});
for (Frame frm : frms) {
frm.dispose();
}
}
use of java.awt.GraphicsConfiguration in project jdk8u_jdk by JetBrains.
the class NormalizingTransformTest method main.
public static void main(String[] args) {
GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
AffineTransform normTransform = gc.getNormalizingTransform();
int dpiX = Toolkit.getDefaultToolkit().getScreenResolution();
int normDpiX = (int) (normTransform.getScaleX() * 72.0);
if (dpiX != normDpiX) {
throw new RuntimeException("Test FAILED. Toolkit.getScreenResolution()=" + dpiX + " GraphicsConfiguration.getNormalizingTransform()=" + normDpiX);
}
System.out.println("Test PASSED. DPI=" + normDpiX);
}
use of java.awt.GraphicsConfiguration in project jdk8u_jdk by JetBrains.
the class X11GraphicsDevice method makeConfigurations.
private void makeConfigurations() {
if (configs == null) {
// Index 0 is always the default config
int i = 1;
int num = getNumConfigs(screen);
GraphicsConfiguration[] ret = new GraphicsConfiguration[num];
if (defaultConfig == null) {
ret[0] = getDefaultConfiguration();
} else {
ret[0] = defaultConfig;
}
boolean glxSupported = X11GraphicsEnvironment.isGLXAvailable();
boolean xrenderSupported = X11GraphicsEnvironment.isXRenderAvailable();
boolean dbeSupported = isDBESupported();
if (dbeSupported && doubleBufferVisuals == null) {
doubleBufferVisuals = new HashSet();
getDoubleBufferVisuals(screen);
}
for (; i < num; i++) {
int visNum = getConfigVisualId(i, screen);
int depth = getConfigDepth(i, screen);
if (glxSupported) {
ret[i] = GLXGraphicsConfig.getConfig(this, visNum);
}
if (ret[i] == null) {
boolean doubleBuffer = (dbeSupported && doubleBufferVisuals.contains(Integer.valueOf(visNum)));
if (xrenderSupported) {
ret[i] = XRGraphicsConfig.getConfig(this, visNum, depth, getConfigColormap(i, screen), doubleBuffer);
} else {
ret[i] = X11GraphicsConfig.getConfig(this, visNum, depth, getConfigColormap(i, screen), doubleBuffer);
}
}
}
configs = ret;
}
}
use of java.awt.GraphicsConfiguration in project jdk8u_jdk by JetBrains.
the class X11GraphicsDevice method getDefaultDisplayMode.
private DisplayMode getDefaultDisplayMode() {
GraphicsConfiguration gc = getDefaultConfiguration();
Rectangle r = gc.getBounds();
return new DisplayMode(r.width, r.height, DisplayMode.BIT_DEPTH_MULTI, DisplayMode.REFRESH_RATE_UNKNOWN);
}
use of java.awt.GraphicsConfiguration in project jdk8u_jdk by JetBrains.
the class D3DSurfaceData method getGC.
private static D3DGraphicsConfig getGC(WComponentPeer peer) {
GraphicsConfiguration gc;
if (peer != null) {
gc = peer.getGraphicsConfiguration();
} else {
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = env.getDefaultScreenDevice();
gc = gd.getDefaultConfiguration();
}
return (gc instanceof D3DGraphicsConfig) ? (D3DGraphicsConfig) gc : null;
}
Aggregations