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?