Restore JInternalFrame

ivanthepro
ivanthepro used Ask the Experts™
on
I have a JInternalFrame added to my JDesktopPane.
Now, when the frame is minimised, i want to restore it to its original position and location by clicking another btn. How do I achieve this?

thanks

Ivan
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Pardon my confusion but when I click on a JInternal frame's minimize button and then click on its minimized representation it does restore to its former position.
Pardon my confusion but when I click on a JInternal frame's minimize button and then click on its minimized representation it does restore to its former position.
Sorry about that.
Commented:

You mean you want to restore it to normal size by clicking a DIFFERENT button than the "iconified" button, right?

Use JInternalFrame.setIcon(false);

As in:
JInternalFrame iFrame = new JInternalFrame(...);
...
JButton button = new JButton("Return to Normal");
button.addActionListener(new ButtonListener());

class ButtonListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
  iFrame.setIcon(false);
}
}

Disclaimer: I can't say I've ever used setIcon (well I could, but I'd be lying), but from the docs it looks like it will work.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial