/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This class is a temporary workaround for bug 4834918:
* Win L&F: JInternalFrame should merge with JMenuBar when maximized.
* It is not a general solution, but intended for use within the
*/
@SuppressWarnings("serial")
private boolean isXP;
boolean closable, boolean maximizable,
boolean iconifiable) {
init();
}
private void init() {
normalBorder = getBorder();
if (isXP) {
setRootPaneCheckingEnabled(false);
pcl = new PropertyChangeListener() {
updateFrame();
}
}
};
}
}
}
private void updateFrame() {
return;
}
// Merge title bar into menu bar
// Move buttons to menu bar
if (c instanceof JButton) {
} else if (c instanceof JLabel) {
// This is the system menu icon
}
}
}
}
} else {
// Restore title bar
// Move buttons back to title bar
}
}
}
}
}
}
public void updateUI() {
if (isMax) {
try {
setMaximum(false);
} catch (PropertyVetoException ex) { }
}
super.updateUI();
init();
if (isMax) {
try {
setMaximum(true);
} catch (PropertyVetoException ex) { }
}
}
}
}
return mainFrame;
}
if (mainMenuBar == null) {
if (mainMenuBar != null &&
}
}
}
return mainMenuBar;
}
if (getMainFrame() != null) {
}
}
}
}
super.layoutContainer(target);
if (c instanceof JButton) {
}
}
}
}
// The rest of this class is messy and should not be relied upon. It
// uses reflection to access private, undocumented, and unsupported
// classes and fields.
//
// Install icon wrappers to display MDI icons when the buttons
// are in the menubar.
//
// Please note that this will very likely fail in a future version
// of Swing, but at least it should fail silently.
//
static {
try {
}
"iconify", "close" }) {
}
} catch (ClassNotFoundException ex) {
}
} catch (NoSuchFieldException ex) {
}
} catch (IllegalAccessException ex) {
}
}
}
}
// A wrapper class for the title pane button icons.
// This code should really go in the WindowsIconsFactory class.
windowsIcon = icon;
if (WP_MINBUTTON != null) {
try {
part.setAccessible(true);
} catch (NoSuchFieldException ex) {
}
}
}
}
try {
// Use MDI icons
if (v == WP_MINBUTTON) {
} else if (v == WP_RESTOREBUTTON) {
} else if (v == WP_CLOSEBUTTON) {
}
} else {
// Use regular icons
if (v == WP_MDIMINBUTTON) {
} else if (v == WP_MDIRESTOREBUTTON) {
} else if (v == WP_MDICLOSEBUTTON) {
}
}
} catch (IllegalAccessException ex) {
}
}
}
windowsIcon.paintIcon(c, g, x, y);
}
public int getIconWidth(){
return windowsIcon.getIconWidth();
}
public int getIconHeight() {
return windowsIcon.getIconHeight();
}
}
// Use reflection to invoke protected methods in BasicInternalFrameTitlePane
private void updateButtonStates() {
try {
if (setButtonIcons == null) {
setButtonIcons.setAccessible(true);
enableActions.setAccessible(true);
}
}
}
}
}