Problem to automatically adjust JDialog size
Hello all,
i have a form (JDialog) which consist of some jlabels and jtextfields.
There is a JLable on the top of the JDialog - which will be used to show hints or errors.
The user fill the form and press save.
If the validation was not succeeded, the JLable on the top shows text.
jlblText.setText("<html><body>Error. Please do this and that. </body></html>")
view.pack();
This text can have different length, so I put it in html tags for wrapping.
The problem is: top JLable changes its height so, that all buttons and some text fields below go down and are invisible. JDialog doesn't adjust it's size, after the height of the lable was changed.
The following code shows the same height of the jlable as it was before. No matter, whether I input 20 lines of text or 2 words.
System.out.println("height = "+view.jlblText().getHeight());
If I knew the real heigh of the jlable, I could adjust the size of the view.
I don't know, why JDialog doesn't adjust it itself, if the height of the lable was changed.
JScrollPane could solve my problem. But it can't be used in this case.
Thanks in advance.

