GetHeight(), getWidth(),,,

Advertisement
hi
Are thes values returned by the getHeight(), getWidth() and others methods in pixels or not ?
thank you
Advertisement

Replay

import java.awt.*;
import javax.swing.*;
public class Example {
    public static void main(String[] args) {
        JWindow w = new JWindow();
        JLabel label = new JLabel("just a label");
        w.getContentPane().add(label, BorderLayout.CENTER);
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gd = ge.getDefaultScreenDevice();
        try {
            gd.setFullScreenWindow(w);
            gd.setDisplayMode(new DisplayMode(640,480, 8, DisplayMode.REFRESH_RATE_UNKNOWN));
            System.out.println(label.getSize());
            try { Thread.sleep(2000); } catch(InterruptedException e) {}
            gd.setDisplayMode(new DisplayMode(800,600, 8, DisplayMode.REFRESH_RATE_UNKNOWN));
            System.out.println(label.getSize());
            try { Thread.sleep(2000); } catch(InterruptedException e) {}
        } finally {
            gd.setFullScreenWindow(null);
            System.exit(0);
}