Search in sources :

Example 11 with GraphicsEnvironment

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()]);
}
Also used : DisplayMode(com.badlogic.gdx.Graphics.DisplayMode) GraphicsDevice(java.awt.GraphicsDevice) ArrayList(java.util.ArrayList) GraphicsEnvironment(java.awt.GraphicsEnvironment)

Example 12 with GraphicsEnvironment

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);
}
Also used : GraphicsDevice(java.awt.GraphicsDevice) Insets(java.awt.Insets) Toolkit(java.awt.Toolkit) Dimension(java.awt.Dimension) GraphicsEnvironment(java.awt.GraphicsEnvironment) Point(java.awt.Point) GradientPaint(java.awt.GradientPaint)

Example 13 with GraphicsEnvironment

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);
}
Also used : BorderLayout(java.awt.BorderLayout) Dimension(java.awt.Dimension) GraphicsEnvironment(java.awt.GraphicsEnvironment)

Example 14 with GraphicsEnvironment

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;
}
Also used : GraphicsDevice(java.awt.GraphicsDevice) Toolkit(java.awt.Toolkit) Dimension(java.awt.Dimension) GraphicsEnvironment(java.awt.GraphicsEnvironment)

Example 15 with GraphicsEnvironment

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);
}
Also used : Dimension(java.awt.Dimension) GraphicsEnvironment(java.awt.GraphicsEnvironment)

Aggregations

GraphicsEnvironment (java.awt.GraphicsEnvironment)87 GraphicsDevice (java.awt.GraphicsDevice)44 GraphicsConfiguration (java.awt.GraphicsConfiguration)41 BufferedImage (java.awt.image.BufferedImage)22 VolatileImage (java.awt.image.VolatileImage)21 Dimension (java.awt.Dimension)16 Graphics2D (java.awt.Graphics2D)16 Point (java.awt.Point)11 Font (java.awt.Font)10 Rectangle (java.awt.Rectangle)9 Insets (java.awt.Insets)7 File (java.io.File)7 Frame (java.awt.Frame)6 Toolkit (java.awt.Toolkit)6 AffineTransform (java.awt.geom.AffineTransform)6 HeadlessException (java.awt.HeadlessException)4 Color (java.awt.Color)3 Container (java.awt.Container)3 DisplayMode (java.awt.DisplayMode)3 GradientPaint (java.awt.GradientPaint)3