1 /*
2 * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
68
69 titlePaneHeight = UIManager.getInt("InternalFrame.titlePaneHeight");
70 buttonWidth = UIManager.getInt("InternalFrame.titleButtonWidth") - 4;
71 buttonHeight = UIManager.getInt("InternalFrame.titleButtonHeight") - 4;
72
73 Object obj = UIManager.get("InternalFrame.titleButtonToolTipsOn");
74 hotTrackingOn = (obj instanceof Boolean) ? (Boolean)obj : true;
75
76
77 if (XPStyle.getXP() != null) {
78 // Fix for XP bug where sometimes these sizes aren't updated properly
79 // Assume for now that height is correct and derive width using the
80 // ratio from the uxtheme part
81 buttonWidth = buttonHeight;
82 Dimension d = XPStyle.getPartSize(Part.WP_CLOSEBUTTON, State.NORMAL);
83 if (d != null && d.width != 0 && d.height != 0) {
84 buttonWidth = (int) ((float) buttonWidth * d.width / d.height);
85 }
86 } else {
87 buttonWidth += 2;
88 selectedTitleGradientColor =
89 UIManager.getColor("InternalFrame.activeTitleGradient");
90 notSelectedTitleGradientColor =
91 UIManager.getColor("InternalFrame.inactiveTitleGradient");
92 Color activeBorderColor =
93 UIManager.getColor("InternalFrame.activeBorderColor");
94 setBorder(BorderFactory.createLineBorder(activeBorderColor, 1));
95 }
96 }
97
98 protected void uninstallListeners() {
99 // Get around protected method in superclass
100 super.uninstallListeners();
101 }
102
103 protected void createButtons() {
104 super.createButtons();
105 if (XPStyle.getXP() != null) {
106 iconButton.setContentAreaFilled(false);
107 maxButton.setContentAreaFilled(false);
108 closeButton.setContentAreaFilled(false);
109 }
110 }
111
112 protected void setButtonIcons() {
113 super.setButtonIcons();
114
115 if (!hotTrackingOn) {
|
1 /*
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
68
69 titlePaneHeight = UIManager.getInt("InternalFrame.titlePaneHeight");
70 buttonWidth = UIManager.getInt("InternalFrame.titleButtonWidth") - 4;
71 buttonHeight = UIManager.getInt("InternalFrame.titleButtonHeight") - 4;
72
73 Object obj = UIManager.get("InternalFrame.titleButtonToolTipsOn");
74 hotTrackingOn = (obj instanceof Boolean) ? (Boolean)obj : true;
75
76
77 if (XPStyle.getXP() != null) {
78 // Fix for XP bug where sometimes these sizes aren't updated properly
79 // Assume for now that height is correct and derive width using the
80 // ratio from the uxtheme part
81 buttonWidth = buttonHeight;
82 Dimension d = XPStyle.getPartSize(Part.WP_CLOSEBUTTON, State.NORMAL);
83 if (d != null && d.width != 0 && d.height != 0) {
84 buttonWidth = (int) ((float) buttonWidth * d.width / d.height);
85 }
86 } else {
87 buttonWidth += 2;
88 Color activeBorderColor =
89 UIManager.getColor("InternalFrame.activeBorderColor");
90 setBorder(BorderFactory.createLineBorder(activeBorderColor, 1));
91 }
92 // JDK-8039383: initialize these colors because getXP() may return null when theme is changed
93 selectedTitleGradientColor =
94 UIManager.getColor("InternalFrame.activeTitleGradient");
95 notSelectedTitleGradientColor =
96 UIManager.getColor("InternalFrame.inactiveTitleGradient");
97 }
98
99 protected void uninstallListeners() {
100 // Get around protected method in superclass
101 super.uninstallListeners();
102 }
103
104 protected void createButtons() {
105 super.createButtons();
106 if (XPStyle.getXP() != null) {
107 iconButton.setContentAreaFilled(false);
108 maxButton.setContentAreaFilled(false);
109 closeButton.setContentAreaFilled(false);
110 }
111 }
112
113 protected void setButtonIcons() {
114 super.setButtonIcons();
115
116 if (!hotTrackingOn) {
|