< prev index next >

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

Print this page

   1 /*
   2  * Copyright (c) 1997, 2021, 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
  23  * questions.
  24  */
  25 
  26 package javax.swing;
  27 
  28 import java.awt.Color;
  29 import java.awt.Component;
  30 import java.awt.Cursor;
  31 import java.awt.Dimension;
  32 import java.awt.Font;
  33 import java.awt.FontMetrics;

  34 import java.awt.Point;
  35 import java.awt.Rectangle;
  36 import java.awt.event.FocusListener;
  37 import java.awt.event.MouseEvent;
  38 import java.beans.BeanProperty;
  39 import java.beans.JavaBean;
  40 import java.beans.Transient;
  41 import java.io.IOException;
  42 import java.io.ObjectInputStream;
  43 import java.io.ObjectOutputStream;
  44 import java.io.Serial;
  45 import java.io.Serializable;
  46 import java.util.ArrayList;
  47 import java.util.Locale;
  48 import java.util.Objects;
  49 
  50 import javax.accessibility.Accessible;
  51 import javax.accessibility.AccessibleComponent;
  52 import javax.accessibility.AccessibleContext;
  53 import javax.accessibility.AccessibleIcon;

2320         }
2321 
2322         public boolean isVisible() {
2323             return parent.isVisible();
2324         }
2325 
2326         public void setVisible(boolean b) {
2327             parent.setVisible(b);
2328         }
2329 
2330         public boolean isShowing() {
2331             return parent.isShowing();
2332         }
2333 
2334         public boolean contains(Point p) {
2335             Rectangle r = getBounds();
2336             return r.contains(p);
2337         }
2338 
2339         public Point getLocationOnScreen() {
2340              Point parentLocation = parent.getLocationOnScreen();





2341              Point componentLocation = getLocation();



2342              componentLocation.translate(parentLocation.x, parentLocation.y);
2343              return componentLocation;
2344         }
2345 
2346         public Point getLocation() {
2347              Rectangle r = getBounds();
2348              return new Point(r.x, r.y);
2349         }
2350 
2351         public void setLocation(Point p) {
2352             // do nothing
2353         }
2354 
2355         public Rectangle getBounds() {
2356             return parent.getUI().getTabBounds(parent, getPageIndex());
2357         }
2358 
2359         public void setBounds(Rectangle r) {
2360             // do nothing
2361         }
2362 
2363         public Dimension getSize() {
2364             Rectangle r = getBounds();
2365             return new Dimension(r.width, r.height);
2366         }
2367 
2368         public void setSize(Dimension d) {
2369             // do nothing
2370         }
2371 
2372         public Accessible getAccessibleAt(Point p) {
2373             if (component instanceof Accessible) {
2374                 return (Accessible) component;
2375             } else {
2376                 return null;
2377             }
2378         }
2379 
2380         public boolean isFocusTraversable() {
2381             return false;
2382         }
2383 
2384         public void requestFocus() {
2385             // do nothing

   1 /*
   2  * Copyright (c) 1997, 2024, 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
  23  * questions.
  24  */
  25 
  26 package javax.swing;
  27 
  28 import java.awt.Color;
  29 import java.awt.Component;
  30 import java.awt.Cursor;
  31 import java.awt.Dimension;
  32 import java.awt.Font;
  33 import java.awt.FontMetrics;
  34 import java.awt.IllegalComponentStateException;
  35 import java.awt.Point;
  36 import java.awt.Rectangle;
  37 import java.awt.event.FocusListener;
  38 import java.awt.event.MouseEvent;
  39 import java.beans.BeanProperty;
  40 import java.beans.JavaBean;
  41 import java.beans.Transient;
  42 import java.io.IOException;
  43 import java.io.ObjectInputStream;
  44 import java.io.ObjectOutputStream;
  45 import java.io.Serial;
  46 import java.io.Serializable;
  47 import java.util.ArrayList;
  48 import java.util.Locale;
  49 import java.util.Objects;
  50 
  51 import javax.accessibility.Accessible;
  52 import javax.accessibility.AccessibleComponent;
  53 import javax.accessibility.AccessibleContext;
  54 import javax.accessibility.AccessibleIcon;

2321         }
2322 
2323         public boolean isVisible() {
2324             return parent.isVisible();
2325         }
2326 
2327         public void setVisible(boolean b) {
2328             parent.setVisible(b);
2329         }
2330 
2331         public boolean isShowing() {
2332             return parent.isShowing();
2333         }
2334 
2335         public boolean contains(Point p) {
2336             Rectangle r = getBounds();
2337             return r.contains(p);
2338         }
2339 
2340         public Point getLocationOnScreen() {
2341              Point parentLocation;
2342              try {
2343                  parentLocation = parent.getLocationOnScreen();
2344              } catch (IllegalComponentStateException icse) {
2345                  return null;
2346              }
2347              Point componentLocation = getLocation();
2348              if (parentLocation == null || componentLocation == null) {
2349                  return null;
2350              }
2351              componentLocation.translate(parentLocation.x, parentLocation.y);
2352              return componentLocation;
2353         }
2354 
2355         public Point getLocation() {
2356              Rectangle r = getBounds();
2357              return r == null ? null : new Point(r.x, r.y);
2358         }
2359 
2360         public void setLocation(Point p) {
2361             // do nothing
2362         }
2363 
2364         public Rectangle getBounds() {
2365             return parent.getUI().getTabBounds(parent, getPageIndex());
2366         }
2367 
2368         public void setBounds(Rectangle r) {
2369             // do nothing
2370         }
2371 
2372         public Dimension getSize() {
2373             Rectangle r = getBounds();
2374             return r == null ? null : new Dimension(r.width, r.height);
2375         }
2376 
2377         public void setSize(Dimension d) {
2378             // do nothing
2379         }
2380 
2381         public Accessible getAccessibleAt(Point p) {
2382             if (component instanceof Accessible) {
2383                 return (Accessible) component;
2384             } else {
2385                 return null;
2386             }
2387         }
2388 
2389         public boolean isFocusTraversable() {
2390             return false;
2391         }
2392 
2393         public void requestFocus() {
2394             // do nothing
< prev index next >