I'm trying to make a JDialog
with the size of the JOptionPane
that contains, but function getSize
is returning something a little bit smaller than the JOptionPane
and the button of accept is not seen.
I'm trying this:
JOptionPane panel = new JOptionPane(orden);
JDialog informa = panel.createDialog("Orden");
//panel.validate();
informa.setSize(panel.getSize());
where orden
is a String
with the info I want to display.
I'm not trying a scroll bar because it will be horizontal scroll and its uncomfortable.
EDIT: If I try to reach the size with
informa.setSize(panel.getWidth(),panel.getHeight());
It happens exactly the same, it gets the right width but it gets a little bit less height, so I guess the getHeight is failing.
MY SOLUTION: Just adding 25 to getHeight
informa.setSize(panel.getWidth(),panel.getHeight()+25);