While researching some kind of problem in my application, I just discovered some strange thing.
Basically this SSCCE should demonstrate the problem:
public class MainFrame extends JFrame {
public MainFrame() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setExtendedState(JFrame.MAXIMIZED_BOTH);
pack();
}
}
public class Main {
public static void main(String[] args) {
MainFrame mf = new MainFrame();
mf.setVisible(true);
System.out.println(mf.getSize());
}
}
Somehow on my monitor with a resolution of 1280x1024 this leads to:
java.awt.Dimension [width = 1296 height = 1010]
Does anyone know how this happens? Especially the fact that the width is higher than what should happen.
Sincerely.
skiwi source
share