src/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameUI.java

Print this page


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


 113 
 114     public JComponent createNorthPane(JInternalFrame w) {
 115         titlePane = new MotifInternalFrameTitlePane(w);
 116         return titlePane;
 117     }
 118 
 119     public Dimension getMaximumSize(JComponent x) {
 120         return Toolkit.getDefaultToolkit().getScreenSize();
 121     }
 122 
 123     protected void uninstallKeyboardActions(){
 124       super.uninstallKeyboardActions();
 125       if (isKeyBindingRegistered()){
 126         JInternalFrame.JDesktopIcon di = frame.getDesktopIcon();
 127         SwingUtilities.replaceUIActionMap(di, null);
 128         SwingUtilities.replaceUIInputMap(di, JComponent.WHEN_IN_FOCUSED_WINDOW,
 129                                          null);
 130       }
 131     }
 132 

 133     protected void setupMenuOpenKey(){
 134         super.setupMenuOpenKey();
 135         ActionMap map = SwingUtilities.getUIActionMap(frame);
 136         if (map != null) {
 137             // BasicInternalFrameUI creates an action with the same name, we override
 138             // it as MotifInternalFrameTitlePane has a titlePane ivar that shadows the
 139             // titlePane ivar in BasicInternalFrameUI, making supers action throw
 140             // an NPE for us.
 141             map.put("showSystemMenu", new AbstractAction(){
 142                 public void actionPerformed(ActionEvent e){
 143                     titlePane.showSystemMenu();
 144                 }
 145                 public boolean isEnabled(){
 146                     return isKeyBindingActive();
 147                 }
 148             });
 149         }
 150     }
 151 

 152     protected void setupMenuCloseKey(){
 153         ActionMap map = SwingUtilities.getUIActionMap(frame);
 154         if (map != null) {
 155             map.put("hideSystemMenu", new AbstractAction(){
 156                 public void actionPerformed(ActionEvent e){
 157                     titlePane.hideSystemMenu();
 158                 }
 159                 public boolean isEnabled(){
 160                     return isKeyBindingActive();
 161                 }
 162             });
 163         }
 164 
 165         // Set up the bindings for the DesktopIcon, it is odd that
 166         // we install them, and not the desktop icon.
 167         JInternalFrame.JDesktopIcon di = frame.getDesktopIcon();
 168         InputMap diInputMap = SwingUtilities.getUIInputMap
 169                           (di, JComponent.WHEN_IN_FOCUSED_WINDOW);
 170         if (diInputMap == null) {
 171             Object[] bindings = (Object[])UIManager.get


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


 113 
 114     public JComponent createNorthPane(JInternalFrame w) {
 115         titlePane = new MotifInternalFrameTitlePane(w);
 116         return titlePane;
 117     }
 118 
 119     public Dimension getMaximumSize(JComponent x) {
 120         return Toolkit.getDefaultToolkit().getScreenSize();
 121     }
 122 
 123     protected void uninstallKeyboardActions(){
 124       super.uninstallKeyboardActions();
 125       if (isKeyBindingRegistered()){
 126         JInternalFrame.JDesktopIcon di = frame.getDesktopIcon();
 127         SwingUtilities.replaceUIActionMap(di, null);
 128         SwingUtilities.replaceUIInputMap(di, JComponent.WHEN_IN_FOCUSED_WINDOW,
 129                                          null);
 130       }
 131     }
 132 
 133     @SuppressWarnings("serial") // anonymous class
 134     protected void setupMenuOpenKey(){
 135         super.setupMenuOpenKey();
 136         ActionMap map = SwingUtilities.getUIActionMap(frame);
 137         if (map != null) {
 138             // BasicInternalFrameUI creates an action with the same name, we override
 139             // it as MotifInternalFrameTitlePane has a titlePane ivar that shadows the
 140             // titlePane ivar in BasicInternalFrameUI, making supers action throw
 141             // an NPE for us.
 142             map.put("showSystemMenu", new AbstractAction(){
 143                 public void actionPerformed(ActionEvent e){
 144                     titlePane.showSystemMenu();
 145                 }
 146                 public boolean isEnabled(){
 147                     return isKeyBindingActive();
 148                 }
 149             });
 150         }
 151     }
 152 
 153     @SuppressWarnings("serial") // anonymous class
 154     protected void setupMenuCloseKey(){
 155         ActionMap map = SwingUtilities.getUIActionMap(frame);
 156         if (map != null) {
 157             map.put("hideSystemMenu", new AbstractAction(){
 158                 public void actionPerformed(ActionEvent e){
 159                     titlePane.hideSystemMenu();
 160                 }
 161                 public boolean isEnabled(){
 162                     return isKeyBindingActive();
 163                 }
 164             });
 165         }
 166 
 167         // Set up the bindings for the DesktopIcon, it is odd that
 168         // we install them, and not the desktop icon.
 169         JInternalFrame.JDesktopIcon di = frame.getDesktopIcon();
 170         InputMap diInputMap = SwingUtilities.getUIInputMap
 171                           (di, JComponent.WHEN_IN_FOCUSED_WINDOW);
 172         if (diInputMap == null) {
 173             Object[] bindings = (Object[])UIManager.get