Reputation: 36884
I am currently trying to maximize a JFace Dialog
programmatically.
Usually calling setMaximized(true)
on the parentShell
of the Dialog
would be sufficient to achieve this.
However, it does not work for my Dialog
. Maximizing it manually using the window buttons works.
Does anybody have an idea how to do it?
Upvotes: 2
Views: 1720
Reputation: 176
Try to do following:
Rectangle bounds = parentShell.getDisplay().getClientArea();
myDialog.setBounds(bounds);
parentShell.setMaximized(true);
UPD: But this approach is not fairly true as this code breaks previous size of you dialog. Following approach seems to work better:
parentShell.pack();
parentShell.setMaximized(true);
Upvotes: 2