How could I create a window which is modal and has a maximize button?
So is it possible to create a modal JFrame
or create a JDialog
with maximize button?
views:
29answers:
1
+1
A:
A JDialog is based on your system look and feel, and on most look and feels, modal windows (such as JDialog
) don't have maximize button because they're not supposed to be maximized (or minimized).
Even if you can do some tricks do add a maximize button, it would be against the way JDialog
works to add it.
If you want to do that you can change your JDialog
for a JWindow
(or JFrame
).
A trick to do this in JDialog
(but it's not recommanded at all) :
setUndecorated(true);
getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
Colin Hebert
2010-10-09 21:36:05
So there isn't any "legal" way to do this? :S
János Harsányi
2010-10-10 14:30:48
@János Harsányi, No, as I said, they're not supposed to have a maximize button.
Colin Hebert
2010-10-10 14:43:24
What about a modal JFrame? No way, too?
János Harsányi
2010-10-10 14:57:40