I'm new in Java and Eclipse. I'm trying to use JOptionPane
class for GUI and getting user input.
When I run the program, I see a very small Java dialog window (attached PrtScr). The same program/ dialog window in other computers shows up with bigger size.
Display resolution of my system is 3200 x 1800 (recommended).
How can I make bigger the default size of this dialog window?
Thank you
Asked
Active
Viewed 2,912 times
1
-
This is a HiDpi problem. I can't really say if JAVA give you any option ... Eclipse just add the manage in the NEON version, could be good to see how they manage it. – AxelH Sep 26 '16 at 09:21
-
There is a "solution" here : http://stackoverflow.com/questions/34149453/java-swing-application-too-small-in-hidpi-computers – AxelH Sep 26 '16 at 09:25
1 Answers
0
You can change your dialog window size with a several options:
1.by using the UIManager
UIManager.put("OptionPane.minimumSize",new Dimension(800,600));
JOptionPane.showOptionDialog(null, "msg", "title", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
2.by resizing dialog size
JOptionPane pane = new JOptionPane("msg", JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION);
JDialog dialog = pane.createDialog(null, "title");
dialog.setSize(new Dimension(800,600));
dialog.show();
3.by putting your dialog window into another Panel, JScrollPane, etc. and resize this Panel
JPanel panel = new JPanel();
panel.setPreferredSize(new Dimension(800,600));
JOptionPane.showOptionDialog(panel, panel, "title", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0]);

Planck Constant
- 1,406
- 1
- 17
- 19
-
And what about the font ? And when you are going to switch to a Full HD screen ? This is due to his HiDPI screen, if you need to force the size of everything, this is going to be painfull. – AxelH Sep 26 '16 at 09:23
-
you are absolutely right! And of course it has to be taken into consideration. But I just answerd quesiton: _"How can I make bigger the default size of this dialog window? "_ – Planck Constant Sep 26 '16 at 09:26
-
Window size changed by importing java.awt.Dimension, but as mentioned fonts are still very small. – Norge Sep 26 '16 at 09:37