aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Internal window setMaximum problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Internal window setMaximum problem" Watch "Internal window setMaximum problem" New topic
Author

Internal window setMaximum problem

Steve Chen
Greenhorn

Joined: Mar 26, 2004
Posts: 3
I have one internal frame created in maximized state. A 2nd internal frame is created in normal state. When I click on 2nd frame, the first frame is changed to normal state.

Anyone know what might cause this behavior? I have spent hours trying to debug this problem, any pointer will be appreciated.

I do not have any other code that setMximum except during initalization. Somehow, _internalWindow has it maximum state changed.
_internalWindow.setMaximum(true);
Steve Chen
Greenhorn

Joined: Mar 26, 2004
Posts: 3
I realize this happens when I change UI manager:

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

In windows XP, this will cause WindowsDesktopManager to be used. In it's activateFrame(JInternalFrame f) method, when a new frame is activated, it will restore the other frame. Anyone know how to get around this problem?

public void activateFrame(JInternalFrame f) {
JInternalFrame currentFrame = currentFrameRef != null ?
currentFrameRef.get() : null;
try {
super.activateFrame(f);
if (currentFrame != null && f != currentFrame) {
// If the current frame is maximized, transfer that
// attribute to the frame being activated.
if (currentFrame.isMaximum() &&
(f.getClientProperty("JInternalFrame.frameType") !=
"optionDialog") ) {
//Special case. If key binding was used to select next
//frame instead of minimizing the icon via the minimize
//icon.
if (!currentFrame.isIcon()) {
currentFrame.setMaximum(false);
if (f.isMaximizable()) {
if (!f.isMaximum()) {
f.setMaximum(true);
} else if (f.isMaximum() && f.isIcon()) {
f.setIcon(false);
} else {
f.setMaximum(false);
}
}
}
}
Steve Chen
Greenhorn

Joined: Mar 26, 2004
Posts: 3
i solved the problem by setting following property, maybe not a proper fix, but at least, i got behavior i wanted.

for popup windows in desktop pane, i added following code:

internalwindow.putClientProperty("JInternalFrame.frameType", "optionDialog");
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Internal window setMaximum problem