use of java.awt.GraphicsDevice in project jdk8u_jdk by JetBrains.
the class NoResizeEventOnDMChangeTest method main.
public static void main(String[] args) {
final GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
if (!gd.isFullScreenSupported()) {
System.out.println("Full screen not supported, test passed");
return;
}
DisplayMode dm = gd.getDisplayMode();
final DisplayMode[] dms = new DisplayMode[2];
for (DisplayMode dm1 : gd.getDisplayModes()) {
if (dm1.getWidth() != dm.getWidth() || dm1.getHeight() != dm.getHeight()) {
dms[0] = dm1;
break;
}
}
if (dms[0] == null) {
System.out.println("Test Passed: all DMs have same dimensions");
return;
}
dms[1] = dm;
Frame f = new Frame() {
@Override
public void paint(Graphics g) {
g.setColor(Color.red);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Color.green);
g.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
}
};
f.setUndecorated(true);
testFSWindow(gd, dms, f);
Window w = new Window(f) {
@Override
public void paint(Graphics g) {
g.setColor(Color.magenta);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Color.cyan);
g.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
}
};
testFSWindow(gd, dms, w);
System.out.println("Test Passed.");
}
use of java.awt.GraphicsDevice in project jdk8u_jdk by JetBrains.
the class DisplayChangeVITest method run.
public void run() {
GraphicsDevice gd = getGraphicsConfiguration().getDevice();
if (gd.isDisplayChangeSupported() && dms.size() > 0) {
while (!done && reps++ < TEST_REPS) {
for (DisplayMode dm : dms) {
System.err.printf("Entering DisplayMode[%dx%dx%d]\n", dm.getWidth(), dm.getHeight(), dm.getBitDepth());
gd.setDisplayMode(dm);
initBackbuffer();
for (int i = 0; i < 10; i++) {
// render to the screen
render(getGraphics());
// ask Swing to repaint
repaint();
sleep(100);
}
sleep(1500);
}
}
} else {
System.err.println("Display mode change " + "not supported. Test passed.");
}
dispose();
synchronized (lock) {
done = true;
lock.notify();
}
}
use of java.awt.GraphicsDevice in project jdk8u_jdk by JetBrains.
the class FullScreenInsets method main.
public static void main(final String[] args) {
final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
final GraphicsDevice[] devices = ge.getScreenDevices();
final Window wGreen = new Frame();
wGreen.setBackground(Color.GREEN);
wGreen.setSize(300, 300);
wGreen.setVisible(true);
sleep();
final Insets iGreen = wGreen.getInsets();
final Dimension sGreen = wGreen.getSize();
final Window wRed = new Frame();
wRed.setBackground(Color.RED);
wRed.setSize(300, 300);
wRed.setVisible(true);
sleep();
final Insets iRed = wGreen.getInsets();
final Dimension sRed = wGreen.getSize();
for (final GraphicsDevice device : devices) {
if (!device.isFullScreenSupported()) {
continue;
}
device.setFullScreenWindow(wGreen);
sleep();
testWindowBounds(device.getDisplayMode(), wGreen);
testColor(wGreen, Color.GREEN);
device.setFullScreenWindow(wRed);
sleep();
testWindowBounds(device.getDisplayMode(), wRed);
testColor(wRed, Color.RED);
device.setFullScreenWindow(null);
sleep();
testInsets(wGreen.getInsets(), iGreen);
testInsets(wRed.getInsets(), iRed);
testSize(wGreen.getSize(), sGreen);
testSize(wRed.getSize(), sRed);
}
wGreen.dispose();
wRed.dispose();
if (!passed) {
throw new RuntimeException("Test failed");
}
}
use of java.awt.GraphicsDevice in project jdk8u_jdk by JetBrains.
the class XMouseInfoPeer method fillPointWithCoords.
public int fillPointWithCoords(Point point) {
long display = XToolkit.getDisplay();
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gds = ge.getScreenDevices();
int gdslen = gds.length;
XToolkit.awtLock();
try {
for (int i = 0; i < gdslen; i++) {
long screenRoot = XlibWrapper.RootWindow(display, i);
boolean pointerFound = XlibWrapper.XQueryPointer(display, screenRoot, // root_return
XlibWrapper.larg1, // child_return
XlibWrapper.larg2, // xr_return
XlibWrapper.larg3, // yr_return
XlibWrapper.larg4, // xw_return
XlibWrapper.larg5, // yw_return
XlibWrapper.larg6, // mask_return
XlibWrapper.larg7);
if (pointerFound) {
point.x = Native.getInt(XlibWrapper.larg3);
point.y = Native.getInt(XlibWrapper.larg4);
return i;
}
}
} finally {
XToolkit.awtUnlock();
}
// this should never happen
assert false : "No pointer found in the system.";
return 0;
}
use of java.awt.GraphicsDevice in project jdk8u_jdk by JetBrains.
the class X11SurfaceData method getGC.
public static X11GraphicsConfig getGC(X11ComponentPeer peer) {
if (peer != null) {
return (X11GraphicsConfig) peer.getGraphicsConfiguration();
} else {
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = env.getDefaultScreenDevice();
return (X11GraphicsConfig) gd.getDefaultConfiguration();
}
}
Aggregations