1

When I close the jinternalframe it's selected jcombobox data and data added textfeilds stays where it was when it was closing(not saving).

This is my closing source code:

private void formInternalFrameClosing(javax.swing.event.InternalFrameEvent evt) {
    try {
        if (no != null) {
            int confirmed = JOptionPane.showConfirmDialog(null,
                "Are you sure you want to exit the program?", 
                "Exit Program Message Box",
                JOptionPane.YES_NO_OPTION);

            if (confirmed == JOptionPane.YES_OPTION) {
                this.dispose();
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

I can't show image but when I'm opening that pre-closed jinternalframe again every selected data are same on new jinternalfrmae too.

I tried this code before. but when I clicked closeing button jinternalframe is not even closing. This is the old code:

NewOrder no;
try {
    if (no != null) {
        int confirmed = JOptionPane.showConfirmDialog(null,
            "Are you sure you want to exit the program?", 
            "Exit Program Message Box",
            JOptionPane.YES_NO_OPTION);

        if (confirmed == JOptionPane.YES_OPTION) {
            this.dispose();
        }
    }
} catch (Exception e) {
    e.printStackTrace();
}

This is not even working.. Please help. If you need more explanation please ask.

Edited problem again.

Lets say I filled name and address in internalframe and I closed it with out saving any data.. And if I opened it again those entered data will be there. I use to close the jinternalframe by given first source code. Second source code is not even working..

Dil.
  • 1,996
  • 7
  • 41
  • 68
  • 1
    Could you try to clear up the writing? I'm not a native English speaker, but this looks a bit hastily written. Take your time, and explain the actual problem(s) you have now. I suspect you have some static variables holding the state even after the pane closes. – This company is turning evil. Nov 02 '14 at 10:48
  • You can't re-open a disposed window. Your question still doesn't make sense. – user207421 Nov 02 '14 at 11:03
  • @EJP but it is opening very well. Should I add opening source code too. – Dil. Nov 02 '14 at 11:04
  • The closing method is fine. How do you open? If you re-use the reference, then you'll get the same frame back. Instead create a new instance when opening - then it'll be fresh. – Vineet Nov 02 '14 at 16:21
  • @ Vineet Ramachandran that source code already here. can you please take a look at that please.. http://stackoverflow.com/questions/26699125/how-to-bring-jinternalframe-to-front-from-all-opened-jinternalframes/26700060#26700060 – Dil. Nov 02 '14 at 16:52

0 Answers0