src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java

Print this page


   1 /*
   2  * Copyright (c) 2001, 2013, 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


  69 
  70         titlePaneHeight = UIManager.getInt("InternalFrame.titlePaneHeight");
  71         buttonWidth     = UIManager.getInt("InternalFrame.titleButtonWidth")  - 4;
  72         buttonHeight    = UIManager.getInt("InternalFrame.titleButtonHeight") - 4;
  73 
  74         Object obj      = UIManager.get("InternalFrame.titleButtonToolTipsOn");
  75         hotTrackingOn = (obj instanceof Boolean) ? (Boolean)obj : true;
  76 
  77 
  78         if (XPStyle.getXP() != null) {
  79             // Fix for XP bug where sometimes these sizes aren't updated properly
  80             // Assume for now that height is correct and derive width using the
  81             // ratio from the uxtheme part
  82             buttonWidth = buttonHeight;
  83             Dimension d = XPStyle.getPartSize(Part.WP_CLOSEBUTTON, State.NORMAL);
  84             if (d != null && d.width != 0 && d.height != 0) {
  85                 buttonWidth = (int) ((float) buttonWidth * d.width / d.height);
  86             }
  87         } else {
  88             buttonWidth += 2;
  89             selectedTitleGradientColor =
  90                     UIManager.getColor("InternalFrame.activeTitleGradient");
  91             notSelectedTitleGradientColor =
  92                     UIManager.getColor("InternalFrame.inactiveTitleGradient");
  93             Color activeBorderColor =
  94                     UIManager.getColor("InternalFrame.activeBorderColor");
  95             setBorder(BorderFactory.createLineBorder(activeBorderColor, 1));
  96         }





  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) {


   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


  69 
  70         titlePaneHeight = UIManager.getInt("InternalFrame.titlePaneHeight");
  71         buttonWidth     = UIManager.getInt("InternalFrame.titleButtonWidth")  - 4;
  72         buttonHeight    = UIManager.getInt("InternalFrame.titleButtonHeight") - 4;
  73 
  74         Object obj      = UIManager.get("InternalFrame.titleButtonToolTipsOn");
  75         hotTrackingOn = (obj instanceof Boolean) ? (Boolean)obj : true;
  76 
  77 
  78         if (XPStyle.getXP() != null) {
  79             // Fix for XP bug where sometimes these sizes aren't updated properly
  80             // Assume for now that height is correct and derive width using the
  81             // ratio from the uxtheme part
  82             buttonWidth = buttonHeight;
  83             Dimension d = XPStyle.getPartSize(Part.WP_CLOSEBUTTON, State.NORMAL);
  84             if (d != null && d.width != 0 && d.height != 0) {
  85                 buttonWidth = (int) ((float) buttonWidth * d.width / d.height);
  86             }
  87         } else {
  88             buttonWidth += 2;




  89             Color activeBorderColor =
  90                     UIManager.getColor("InternalFrame.activeBorderColor");
  91             setBorder(BorderFactory.createLineBorder(activeBorderColor, 1));
  92         }
  93         // JDK-8039383: initialize these colors because getXP() may return null when theme is changed
  94         selectedTitleGradientColor =
  95                 UIManager.getColor("InternalFrame.activeTitleGradient");
  96         notSelectedTitleGradientColor =
  97                 UIManager.getColor("InternalFrame.inactiveTitleGradient");
  98     }
  99 
 100     protected void uninstallListeners() {
 101         // Get around protected method in superclass
 102         super.uninstallListeners();
 103     }
 104 
 105     protected void createButtons() {
 106         super.createButtons();
 107         if (XPStyle.getXP() != null) {
 108             iconButton.setContentAreaFilled(false);
 109             maxButton.setContentAreaFilled(false);
 110             closeButton.setContentAreaFilled(false);
 111         }
 112     }
 113 
 114     protected void setButtonIcons() {
 115         super.setButtonIcons();
 116 
 117         if (!hotTrackingOn) {