JComponent undock effect
Posted
by Christo Du Preez
on Stack Overflow
See other posts from Stack Overflow
or by Christo Du Preez
Published on 2010-03-29T12:32:54Z
Indexed on
2010/03/29
12:33 UTC
Read the original article
Hit count: 378
I'm trying to accomplish an undock effect for a custom Swing JComponent. By default the component is used inside a form along with other components. I want to be able to maximize this component to use the whole screen and then be able to dock it again. So far I've tested
public void showDialog() {
JFrame mainFrame = App.getApplication().getMainFrame();
JDialog dialog = new JDialog(mainFrame);
dialog.setModal(true);
dialog.setSize(800, 600); //Set to 80x660 for now
dialog.add(this); //This is my JComponent
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
}
This gives me desired effect but when closing the dialog my component doesn't receive events no more. How can I prevent this?
Or is there perhaps a better way to accomplish this?
© Stack Overflow or respective owner