jdk/src/java.desktop/share/classes/javax/swing/plaf/ComponentUI.java
changeset 26037 508779ce6619
parent 26013 83b99f14245f
parent 25859 3317bb8137f4
equal deleted inserted replaced
25992:e9b05e933ddd 26037:508779ce6619
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     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.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   171      *
   171      *
   172      * @param c the component whose preferred size is being queried;
   172      * @param c the component whose preferred size is being queried;
   173      *          this argument is often ignored,
   173      *          this argument is often ignored,
   174      *          but might be used if the UI object is stateless
   174      *          but might be used if the UI object is stateless
   175      *          and shared by multiple components
   175      *          and shared by multiple components
   176      *
   176      * @return a {@code Dimension} object containing given component's preferred
       
   177      *         size appropriate for the look and feel
   177      * @see javax.swing.JComponent#getPreferredSize
   178      * @see javax.swing.JComponent#getPreferredSize
   178      * @see java.awt.LayoutManager#preferredLayoutSize
   179      * @see java.awt.LayoutManager#preferredLayoutSize
   179      */
   180      */
   180     public Dimension getPreferredSize(JComponent c) {
   181     public Dimension getPreferredSize(JComponent c) {
   181         return null;
   182         return null;
   238      *          this argument is often ignored,
   239      *          this argument is often ignored,
   239      *          but might be used if the UI object is stateless
   240      *          but might be used if the UI object is stateless
   240      *          and shared by multiple components
   241      *          and shared by multiple components
   241      * @param x the <i>x</i> coordinate of the point
   242      * @param x the <i>x</i> coordinate of the point
   242      * @param y the <i>y</i> coordinate of the point
   243      * @param y the <i>y</i> coordinate of the point
   243      *
   244      * @return {@code true} if the specified {@code x,y} location is contained
       
   245      *         within the look and feel's defined shape for the given component
   244      * @see javax.swing.JComponent#contains
   246      * @see javax.swing.JComponent#contains
   245      * @see java.awt.Component#contains
   247      * @see java.awt.Component#contains
   246      */
   248      */
   247     @SuppressWarnings("deprecation")
   249     @SuppressWarnings("deprecation")
   248     public boolean contains(JComponent c, int x, int y) {
   250     public boolean contains(JComponent c, int x, int y) {
   256      * If the UI delegate subclass is stateless, it may return an instance
   258      * If the UI delegate subclass is stateless, it may return an instance
   257      * that is shared by multiple components.  If the UI delegate is
   259      * that is shared by multiple components.  If the UI delegate is
   258      * stateful, then it should return a new instance per component.
   260      * stateful, then it should return a new instance per component.
   259      * The default implementation of this method throws an error, as it
   261      * The default implementation of this method throws an error, as it
   260      * should never be invoked.
   262      * should never be invoked.
       
   263      *
       
   264      * @param c a {@code JComponent} for which to create a UI delegate
       
   265      * @return a {@code ComponentUI} object for {@code c}
   261      */
   266      */
   262     public static ComponentUI createUI(JComponent c) {
   267     public static ComponentUI createUI(JComponent c) {
   263         throw new Error("ComponentUI.createUI not implemented.");
   268         throw new Error("ComponentUI.createUI not implemented.");
   264     }
   269     }
   265 
   270 
   330      *
   335      *
   331      * Note: As of v1.3, it is recommended that developers call
   336      * Note: As of v1.3, it is recommended that developers call
   332      * <code>Component.AccessibleAWTComponent.getAccessibleChildrenCount()</code> instead
   337      * <code>Component.AccessibleAWTComponent.getAccessibleChildrenCount()</code> instead
   333      * of this method.
   338      * of this method.
   334      *
   339      *
       
   340      * @param c {@code JComponent} for which to get count of accessible children
       
   341      * @return the number of accessible children in the object
   335      * @see #getAccessibleChild
   342      * @see #getAccessibleChild
   336      * @return the number of accessible children in the object
       
   337      */
   343      */
   338     public int getAccessibleChildrenCount(JComponent c) {
   344     public int getAccessibleChildrenCount(JComponent c) {
   339         return SwingUtilities.getAccessibleChildrenCount(c);
   345         return SwingUtilities.getAccessibleChildrenCount(c);
   340     }
   346     }
   341 
   347 
   349      *
   355      *
   350      * Note: As of v1.3, it is recommended that developers call
   356      * Note: As of v1.3, it is recommended that developers call
   351      * <code>Component.AccessibleAWTComponent.getAccessibleChild()</code> instead of
   357      * <code>Component.AccessibleAWTComponent.getAccessibleChild()</code> instead of
   352      * this method.
   358      * this method.
   353      *
   359      *
   354      * @see #getAccessibleChildrenCount
   360      * @param c a {@code JComponent} for which to get a child object
   355      * @param i zero-based index of child
   361      * @param i zero-based index of child
   356      * @return the <code>i</code>th <code>Accessible</code> child of the object
   362      * @return the <code>i</code>th <code>Accessible</code> child of the object
       
   363      * @see #getAccessibleChildrenCount
   357      */
   364      */
   358     public Accessible getAccessibleChild(JComponent c, int i) {
   365     public Accessible getAccessibleChild(JComponent c, int i) {
   359         return SwingUtilities.getAccessibleChild(c, i);
   366         return SwingUtilities.getAccessibleChild(c, i);
   360     }
   367     }
   361 }
   368 }