setIcon(false); darn it …
a week, I’ve been coding uselessly, trying to redisplay my singleton JInternalFrame after it was minimized. I tried to add the setBounds(…) and toFront() but it didn’t appear from its minimized condition.
a week of coding and recoding and searching and searching, only to find that I only need to add this one:
try {
singletonIF.setIcon(false);
} catch (PropertyVetoException ex) {
ex.printStackTrace();
}
in order to release it from its minimized state.
and here is the code I needed to call the JInternalFrame as a singleton.
public static ifmGudang callTheInternalFrame(
Container parent) {
/*
* Make sure it will have a parent
* to contain it.
* if the parent is null,
* set frMain (the main form class)
* as it's parents.
*/
if (parent == null) {
/*
* this is my own static method
* to pass frMain's ContentPane
* as this singleton's parent.
*/
parent = frMain.setAsParent();
}
/*
* make sure that the new instance
* will be created ONLY IF the singleton is null.
*/
if (singletonIF == null) {
singletonIF = new ifmGudang();
parent.add(singletonIF,
javax.swing.JLayeredPane.DEFAULT_LAYER);
} else {
/*
* needs to set Iconified false
* to release its minimized state.
* found it that this one is needed
* to be applied before I add the
* setBounds(...)
*/
try {
singletonIF.setIcon(false);
} catch (PropertyVetoException ex) {
ex.printStackTrace();
}
singletonIF.toFront();
}
/*
* make sure the singleton bounds
* with its parents.
*/
singletonIF.setBounds(0, 0,
singletonIF.getParent().getWidth(),
singletonIF.getParent().getHeight());
singletonIF.show();
return singletonIF;
}
hhh … it was only setIcon(false); thingy … darn it. the documentation reading was not as easy as I thought.
