use of java.awt.GraphicsEnvironment in project libgdx by libgdx.
the class LwjglApplicationConfiguration method getDisplayModes.
public static DisplayMode[] getDisplayModes() {
GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice device = genv.getDefaultScreenDevice();
java.awt.DisplayMode desktopMode = device.getDisplayMode();
java.awt.DisplayMode[] displayModes = device.getDisplayModes();
ArrayList<DisplayMode> modes = new ArrayList<DisplayMode>();
int idx = 0;
for (java.awt.DisplayMode mode : displayModes) {
boolean duplicate = false;
for (int i = 0; i < modes.size(); i++) {
if (modes.get(i).width == mode.getWidth() && modes.get(i).height == mode.getHeight() && modes.get(i).bitsPerPixel == mode.getBitDepth()) {
duplicate = true;
break;
}
}
if (duplicate)
continue;
if (mode.getBitDepth() != desktopMode.getBitDepth())
continue;
modes.add(new LwjglApplicationConfigurationDisplayMode(mode.getWidth(), mode.getHeight(), mode.getRefreshRate(), mode.getBitDepth()));
}
return modes.toArray(new DisplayMode[modes.size()]);
}
use of java.awt.GraphicsEnvironment in project bigbluebutton by bigbluebutton.
the class WindowlessFrame method centerOnScreen.
public final void centerOnScreen() {
Toolkit kit = mLeftBorder.getToolkit();
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
Insets in = kit.getScreenInsets(gs[0].getDefaultConfiguration());
Dimension d = kit.getScreenSize();
int maxWidth = (d.width - in.left - in.right);
int maxHeight = (d.height - in.top - in.bottom);
setLocation((int) (maxWidth - mOverallSize.width) / 2, (int) (maxHeight - mOverallSize.height) / 2);
}
use of java.awt.GraphicsEnvironment in project smile by haifengl.
the class PlotCanvas method initCanvas.
/**
* Initialize the canvas.
*/
private void initCanvas() {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
if (ge.isHeadless()) {
setPreferredSize(new Dimension(1600, 1200));
}
setLayout(new BorderLayout());
canvas = new MathCanvas();
add(canvas, BorderLayout.CENTER);
initContextMenauAndToolBar();
// set a new dismiss delay to a really big value, default is 4 sec.
//ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE);
}
use of java.awt.GraphicsEnvironment in project h2o-2 by h2oai.
the class AwtRequestParameterDiscoverer method discoverParameters.
@Override
public DefaultRequest discoverParameters(GoogleAnalyticsConfig config, DefaultRequest request) {
super.discoverParameters(config, request);
Toolkit toolkit = Toolkit.getDefaultToolkit();
if (isEmpty(request.screenResolution())) {
Dimension screenSize = toolkit.getScreenSize();
request.screenResolution(((int) screenSize.getWidth()) + "x" + ((int) screenSize.getHeight()) + ", " + toolkit.getScreenResolution() + " dpi");
}
if (isEmpty(request.screenColors())) {
GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] graphicsDevices = graphicsEnvironment.getScreenDevices();
StringBuilder sb = new StringBuilder();
for (GraphicsDevice graphicsDevice : graphicsDevices) {
if (sb.length() != 0) {
sb.append(", ");
}
sb.append(graphicsDevice.getDisplayMode().getBitDepth());
}
request.screenColors(sb.toString());
}
return request;
}
use of java.awt.GraphicsEnvironment in project gephi by gephi.
the class ReportController method logScreenSize.
private void logScreenSize(Report report) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
report.setScreenSize(screenSize);
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
report.setScreenDevices(ge.getScreenDevices().length);
}
Aggregations