views:

29

answers:

1

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?

+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
So there isn't any "legal" way to do this? :S
János Harsányi
@János Harsányi, No, as I said, they're not supposed to have a maximize button.
Colin Hebert
What about a modal JFrame? No way, too?
János Harsányi