< prev index next >

src/java.desktop/share/classes/javax/swing/ToolTipManager.java

Print this page


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


 213      */
 214     public void setReshowDelay(int milliseconds) {
 215         exitTimer.setInitialDelay(milliseconds);
 216     }
 217 
 218     /**
 219      * Returns the reshow delay property.
 220      *
 221      * @return reshown delay property
 222      * @see #setReshowDelay
 223      */
 224     public int getReshowDelay() {
 225         return exitTimer.getInitialDelay();
 226     }
 227 
 228     // Returns GraphicsConfiguration instance that toFind belongs to or null
 229     // if drawing point is set to a point beyond visible screen area (e.g.
 230     // Point(20000, 20000))
 231     private GraphicsConfiguration getDrawingGC(Point toFind) {
 232         GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
 233         GraphicsDevice devices[] = env.getScreenDevices();
 234         for (GraphicsDevice device : devices) {
 235             GraphicsConfiguration config = device.getDefaultConfiguration();
 236             Rectangle rect = config.getBounds();
 237             if (rect.contains(toFind)) {
 238                 return config;
 239             }
 240         }
 241 
 242         return null;
 243     }
 244 
 245     void showTipWindow() {
 246         if(insideComponent == null || !insideComponent.isShowing())
 247             return;
 248         String mode = UIManager.getString("ToolTipManager.enableToolTipMode");
 249         if ("activeApplication".equals(mode)) {
 250             KeyboardFocusManager kfm =
 251                     KeyboardFocusManager.getCurrentKeyboardFocusManager();
 252             if (kfm.getFocusedWindow() == null) {
 253                 return;


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


 213      */
 214     public void setReshowDelay(int milliseconds) {
 215         exitTimer.setInitialDelay(milliseconds);
 216     }
 217 
 218     /**
 219      * Returns the reshow delay property.
 220      *
 221      * @return reshown delay property
 222      * @see #setReshowDelay
 223      */
 224     public int getReshowDelay() {
 225         return exitTimer.getInitialDelay();
 226     }
 227 
 228     // Returns GraphicsConfiguration instance that toFind belongs to or null
 229     // if drawing point is set to a point beyond visible screen area (e.g.
 230     // Point(20000, 20000))
 231     private GraphicsConfiguration getDrawingGC(Point toFind) {
 232         GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
 233         GraphicsDevice[] devices = env.getScreenDevices();
 234         for (GraphicsDevice device : devices) {
 235             GraphicsConfiguration config = device.getDefaultConfiguration();
 236             Rectangle rect = config.getBounds();
 237             if (rect.contains(toFind)) {
 238                 return config;
 239             }
 240         }
 241 
 242         return null;
 243     }
 244 
 245     void showTipWindow() {
 246         if(insideComponent == null || !insideComponent.isShowing())
 247             return;
 248         String mode = UIManager.getString("ToolTipManager.enableToolTipMode");
 249         if ("activeApplication".equals(mode)) {
 250             KeyboardFocusManager kfm =
 251                     KeyboardFocusManager.getCurrentKeyboardFocusManager();
 252             if (kfm.getFocusedWindow() == null) {
 253                 return;


< prev index next >