开发者

JComponent undock effect

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 comp开发者_C百科onents. 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?


Maybe you should take a look at Java docking frameworks. i've recently answered such a question : How to create docking panel in Java? I would suggest you take a look at those docking frameworks, which may directly answer your need.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜