Search code examples
javanetbeansjinternalframe

Stop reopening same window


I just code simple logic to stop opening same window when I click the same button..

enter image description here when I click Item return,that internal frame should setvisible in below jdesktoppane highlighted in black frame..If that already opened just see that no reopening.. same to warranty..But this not work just tell me a way to do that..

Item_Return ir;
try {
        if (ir == null) {
            ir = new Item_Return();
        }
        jDesktopPane3.add(ir).setVisible(true);

    } catch (Exception ex) {
        JOptionPane.showMessageDialog(null, ex);
    }

if I double click that button I got this exception tooillegal component position


Solution

  • Read the section from the Swing tutorial on How to Use Internal Frames. It contains a working example that shows you how to dynamically create and display in internal frame.