JComponent.java revision 1222
1067N/A * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Sun designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Sun in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A * The base class for all Swing components except top-level containers. 0N/A * To use a component that inherits from <code>JComponent</code>, 0N/A * you must place the component in a containment hierarchy 0N/A * whose root is a top-level Swing container. 0N/A * Top-level Swing containers -- 0N/A * such as <code>JFrame</code>, <code>JDialog</code>, 0N/A * and <code>JApplet</code> -- 0N/A * are specialized components 0N/A * that provide a place for other Swing components to paint themselves. 0N/A * For an explanation of containment hierarchies, see 0N/A * a section in <em>The Java Tutorial</em>. 0N/A * The <code>JComponent</code> class provides: 0N/A * <li>The base class for both standard and custom components 0N/A * that use the Swing architecture. 0N/A * <li>A "pluggable look and feel" (L&F) that can be specified by the 0N/A * programmer or (optionally) selected by the user at runtime. 0N/A * The look and feel for each component is provided by a 0N/A * <em>UI delegate</em> -- an object that descends from 0N/A * {@link javax.swing.plaf.ComponentUI}. 0N/A * to Set the Look and Feel</a> 0N/A * in <em>The Java Tutorial</em> 0N/A * for more information. 0N/A * <li>Comprehensive keystroke handling. 0N/A * See the document <a 0N/A * Bindings in Swing</a>, 0N/A * an article in <em>The Swing Connection</em>, 0N/A * for more information. 0N/A * <li>Support for tool tips -- 0N/A * short descriptions that pop up when the cursor lingers 0N/A * to Use Tool Tips</a> 0N/A * in <em>The Java Tutorial</em> 0N/A * for more information. 0N/A * <li>Support for accessibility. 0N/A * <code>JComponent</code> contains all of the methods in the 0N/A * <code>Accessible</code> interface, 0N/A * but it doesn't actually implement the interface. That is the 0N/A * responsibility of the individual classes 0N/A * that extend <code>JComponent</code>. 0N/A * <li>Support for component-specific properties. 0N/A * With the {@link #putClientProperty} 0N/A * and {@link #getClientProperty} methods, 0N/A * you can associate name-object pairs 0N/A * with any object that descends from <code>JComponent</code>. 0N/A * <li>An infrastructure for painting 0N/A * that includes double buffering and support for borders. 0N/A * For more information see <a 0N/A * to Use Borders</a>, 0N/A * both of which are sections in <em>The Java Tutorial</em>. 0N/A * For more information on these subjects, see the 0N/A * and <em>The Java Tutorial</em> section 0N/A * <code>JComponent</code> and its subclasses document default values 0N/A * for certain properties. For example, <code>JTable</code> documents the 0N/A * default row height as 16. Each <code>JComponent</code> subclass 0N/A * that has a <code>ComponentUI</code> will create the 0N/A * <code>ComponentUI</code> as part of its constructor. In order 0N/A * to provide a particular look and feel each 0N/A * <code>ComponentUI</code> may set properties back on the 0N/A * <code>JComponent</code> that created it. For example, a custom 0N/A * look and feel may require <code>JTable</code>s to have a row 0N/A * height of 24. The documented defaults are the value of a property 0N/A * BEFORE the <code>ComponentUI</code> has been installed. If you 0N/A * need a specific value for a particular property you should 0N/A * explicitly set it. 0N/A * In release 1.4, the focus subsystem was rearchitected. 0N/A * For more information, see 0N/A * How to Use the Focus Subsystem</a>, 0N/A * a section in <em>The Java Tutorial</em>. 0N/A * <strong>Warning:</strong> Swing is not thread safe. For more 0N/A * information see <a 0N/A * <strong>Warning:</strong> 0N/A * Serialized objects of this class will not be compatible with 0N/A * future Swing releases. The current serialization support is 0N/A * appropriate for short term storage or RMI between applications running 0N/A * the same version of Swing. As of 1.4, support for long term storage 0N/A * of all JavaBeans<sup><font size="-2">TM</font></sup> 0N/A * has been added to the <code>java.beans</code> package. 0N/A * @see #registerKeyboardAction 0N/A * @see #setDebugGraphicsOptions 0N/A * @see #setToolTipText 0N/A * @see #setAutoscrolls 0N/A * @author Hans Muller 0N/A * @author Arnaud Weber 0N/A * @see #getUIClassID 0N/A * Keys to use for forward focus traversal when the JComponent is 0N/A * Keys to use for backward focus traversal when the JComponent is 0N/A // Following are the possible return values from getObscuredState. 0N/A * Set to true when DebugGraphics has been loaded. 0N/A * Key used to look up a value from the AppContext to determine the 0N/A * JComponent the InputVerifier is running for. That is, if 0N/A * AppContext.get(INPUT_VERIFIER_SOURCE_KEY) returns non-null, it 0N/A * indicates the EDT is calling into the InputVerifier from the 0N/A * returned component. 0N/A /* The following fields support set methods for the corresponding 0N/A * java.awt.Component properties. 0N/A * Backing store for JComponent properties and listeners 0N/A /** The look and feel delegate for this component. */ 0N/A /** A list of event listeners for this component. */ 0N/A * Whether or not autoscroll has been enabled. 0N/A /* Input verifier for this component */ 0N/A * Set in <code>_paintImmediately</code>. 0N/A * Will indicate the child that initiated the painting operation. 0N/A * If <code>paintingChild</code> is opaque, no need to paint 0N/A * any child components after <code>paintingChild</code>. 0N/A * Test used in <code>paintChildren</code>. 0N/A * Constant used for <code>registerKeyboardAction</code> that 0N/A * means that the command should be invoked when 0N/A * the component has the focus. 0N/A * Constant used for <code>registerKeyboardAction</code> that 0N/A * means that the command should be invoked when the receiving 0N/A * component is an ancestor of the focused component or is 0N/A * itself the focused component. 0N/A * Constant used for <code>registerKeyboardAction</code> that 0N/A * means that the command should be invoked when 0N/A * the receiving component is in the window that has the focus 0N/A * or is itself the focused component. 0N/A * Constant used by some of the APIs to mean that no condition is defined. 0N/A * The key used by <code>JComponent</code> to access keyboard bindings. 0N/A * An array of <code>KeyStroke</code>s used for 0N/A * <code>WHEN_IN_FOCUSED_WINDOW</code> are stashed 0N/A * in the client properties under this string. 0N/A * The comment to display when the cursor is over the component, 0N/A * also known as a "value tip", "flyover help", or "flyover label". 0N/A * <code>JPopupMenu</code> assigned to this component 0N/A * and all of its childrens 0N/A /** Private flags **/ 0N/A /** Bits 14-21 are used to handle nested writeObject calls. **/ 0N/A * Temporary rectangles. 0N/A /** Used for <code>WHEN_FOCUSED</code> bindings. */ 0N/A /** Used for <code>WHEN_ANCESTOR_OF_FOCUSED_COMPONENT</code> bindings. */ 0N/A /** Used for <code>WHEN_IN_FOCUSED_KEY</code> bindings. */ 0N/A /** Key used to store the default locale in an AppContext **/ 0N/A * Returns true if {@code c} is the component the graphics is being 0N/A * requested of. This is intended for use when getGraphics is invoked. 0N/A * Returns the Set of <code>KeyStroke</code>s to use if the component 0N/A * is managing focus for forward focus traversal. 0N/A * Returns the Set of <code>KeyStroke</code>s to use if the component 0N/A * is managing focus for backward focus traversal. 0N/A * Sets whether or not <code>getComponentPopupMenu</code> should delegate 0N/A * to the parent if this component does not have a <code>JPopupMenu</code> 0N/A * The default value for this is false, but some <code>JComponent</code> 0N/A * subclasses that are implemented as a number of <code>JComponent</code>s 0N/A * may set this to true. 0N/A * This is a bound property. 0N/A * @param value whether or not the JPopupMenu is inherited 0N/A * @see #setComponentPopupMenu 0N/A * description: Whether or not the JPopupMenu is inherited 0N/A * Returns true if the JPopupMenu should be inherited from the parent. 0N/A * @see #setComponentPopupMenu 0N/A * Sets the <code>JPopupMenu</code> for this <code>JComponent</code>. 0N/A * The UI is responsible for registering bindings and adding the necessary 0N/A * listeners such that the <code>JPopupMenu</code> will be shown at 0N/A * the appropriate time. When the <code>JPopupMenu</code> is shown 0N/A * depends upon the look and feel: some may show it on a mouse event, 0N/A * some may enable a key binding. 0N/A * If <code>popup</code> is null, and <code>getInheritsPopupMenu</code> 0N/A * returns true, then <code>getComponentPopupMenu</code> will be delegated 0N/A * to the parent. This provides for a way to make all child components 0N/A * inherit the popupmenu of the parent. 0N/A * This is a bound property. 0N/A * @param popup - the popup that will be assigned to this component 0N/A * @see #getComponentPopupMenu 0N/A * description: Popup to show 0N/A * Returns <code>JPopupMenu</code> that assigned for this component. 0N/A * If this component does not have a <code>JPopupMenu</code> assigned 0N/A * to it and <code>getInheritsPopupMenu</code> is true, this 0N/A * will return <code>getParent().getComponentPopupMenu()</code> (assuming 0N/A * the parent is valid.) 0N/A * @return <code>JPopupMenu</code> assigned for this component 0N/A * or <code>null</code> if no popup assigned 0N/A * @see #setComponentPopupMenu 0N/A // Search parents for its popup 0N/A // Reached toplevel, break and return null 0N/A * Default <code>JComponent</code> constructor. This constructor does 0N/A * very little initialization beyond calling the <code>Container</code> 0N/A * constructor. For example, the initial layout manager is 0N/A * <code>null</code>. It does, however, set the component's locale 0N/A * property to the value returned by 0N/A * <code>JComponent.getDefaultLocale</code>. 0N/A * @see #getDefaultLocale 0N/A // We enable key events on all JComponents so that accessibility 0N/A // bindings will work everywhere. This is a partial fix to BugID 0N/A "focusTraversalKeysForward",
0N/A "focusTraversalKeysBackward",
0N/A * Resets the UI property to a value from the current look and feel. 0N/A * <code>JComponent</code> subclasses must override this method 0N/A * public void updateUI() { 0N/A * setUI((SliderUI)UIManager.getUI(this); 0N/A * @see UIManager#getLookAndFeel 0N/A * @see UIManager#getUI 0N/A * Sets the look and feel delegate for this component. 0N/A * <code>JComponent</code> subclasses generally override this method 0N/A * to narrow the argument type. For example, in <code>JSlider</code>: 0N/A * public void setUI(SliderUI newUI) { 0N/A * super.setUI(newUI); 0N/A * Additionally <code>JComponent</code> subclasses must provide a 0N/A * <code>getUI</code> method that returns the correct type. For example: 0N/A * public SliderUI getUI() { 0N/A * return (SliderUI)ui; 0N/A * @param newUI the new UI delegate 0N/A * @see UIManager#getLookAndFeel 0N/A * @see UIManager#getUI 0N/A * attribute: visualUpdate true 0N/A * description: The component's look and feel delegate. 0N/A /* We do not check that the UI instance is different 0N/A * before allowing the switch in order to enable the 0N/A * same UI instance *with different default settings* 0N/A // aaText shouldn't persist between look and feels, reset it. 0N/A * Uninstalls the UI, if any, and any client properties designated 0N/A * as being specific to the installed UI - instances of 0N/A * {@code UIClientPropertyKey}. 0N/A //clean UIClientPropertyKeys from client properties 0N/A * Returns the <code>UIDefaults</code> key used to 0N/A * look up the name of the <code>swing.plaf.ComponentUI</code> 0N/A * class that defines the look and feel 0N/A * for this component. Most applications will never need to 0N/A * call this method. Subclasses of <code>JComponent</code> that support 0N/A * pluggable look and feel should override this method to 0N/A * return a <code>UIDefaults</code> key that maps to the 0N/A * <code>ComponentUI</code> subclass that defines their look and feel. 0N/A * @return the <code>UIDefaults</code> key for a 0N/A * <code>ComponentUI</code> subclass 0N/A * @see UIDefaults#getUI 0N/A * description: UIClassID 0N/A * Returns the graphics object used to paint this component. 0N/A * If <code>DebugGraphics</code> is turned on we create a new 0N/A * <code>DebugGraphics</code> object if necessary. 0N/A * Otherwise we just configure the 0N/A * specified graphics object's foreground and font. 0N/A * @param g the original <code>Graphics</code> object 0N/A * @return a <code>Graphics</code> object configured for this component 0N/A * Calls the UI delegate's paint method, if the UI delegate 0N/A * is non-<code>null</code>. We pass the delegate a copy of the 0N/A * <code>Graphics</code> object to protect the rest of the 0N/A * paint code from irrevocable changes 0N/A * (for example, <code>Graphics.translate</code>). 0N/A * If you override this in a subclass you should not make permanent 0N/A * changes to the passed in <code>Graphics</code>. For example, you 0N/A * should not alter the clip <code>Rectangle</code> or modify the 0N/A * transform. If you need to do these operations you may find it 0N/A * easier to create a new <code>Graphics</code> from the passed in 0N/A * <code>Graphics</code> and manipulate it. Further, if you do not 0N/A * invoker super's implementation you must honor the opaque property, 0N/A * if this component is opaque, you must completely fill in the background 0N/A * in a non-opaque color. If you do not honor the opaque property you 0N/A * will likely see visual artifacts. 0N/A * The passed in <code>Graphics</code> object might 0N/A * have a transform other than the identify transform 0N/A * installed on it. In this case, you might get 0N/A * unexpected results if you cumulatively apply 0N/A * another transform. 0N/A * @param g the <code>Graphics</code> object to protect 0N/A * Paints this component's children. 0N/A * If <code>shouldUseBuffer</code> is true, 0N/A * no component ancestor has a buffer and 0N/A * the component children can use a buffer if they have one. 0N/A * Otherwise, one ancestor has a buffer currently in use and children 0N/A * should not use a buffer to paint. 0N/A * @param g the <code>Graphics</code> context in which to paint 0N/A * @see java.awt.Container#paint 0N/A // If we are only to paint to a specific child, determine 0N/A for (; i >=
0; i--) {
0N/A for (; i >=
0 ; i--) {
0N/A * Paints the component's border. 0N/A * If you override this in a subclass you should not make permanent 0N/A * changes to the passed in <code>Graphics</code>. For example, you 0N/A * should not alter the clip <code>Rectangle</code> or modify the 0N/A * transform. If you need to do these operations you may find it 0N/A * easier to create a new <code>Graphics</code> from the passed in 0N/A * <code>Graphics</code> and manipulate it. 0N/A * @param g the <code>Graphics</code> context in which to paint 0N/A * Calls <code>paint</code>. Doesn't clear the background but see 0N/A * <code>ComponentUI.update</code>, which is called by 0N/A * <code>paintComponent</code>. 0N/A * @param g the <code>Graphics</code> context in which to paint 0N/A * @see #paintComponent 0N/A * @see javax.swing.plaf.ComponentUI 0N/A * Invoked by Swing to draw components. 0N/A * Applications should not invoke <code>paint</code> directly, 0N/A * but should instead use the <code>repaint</code> method to 0N/A * schedule the component for redrawing. 0N/A * This method actually delegates the work of painting to three 0N/A * protected methods: <code>paintComponent</code>, 0N/A * <code>paintBorder</code>, 0N/A * and <code>paintChildren</code>. They're called in the order 0N/A * listed to ensure that children appear on top of component itself. 0N/A * Generally speaking, the component and its children should not 0N/A * paint in the insets area allocated to the border. Subclasses can 0N/A * just override this method, as always. A subclass that just 0N/A * wants to specialize the UI (look and feel) delegate's 0N/A * <code>paint</code> method should just override 0N/A * <code>paintComponent</code>. 0N/A * @param g the <code>Graphics</code> context in which to paint 0N/A * @see #paintComponent 0N/A * @see #paintChildren 0N/A * @see #getComponentGraphics 0N/A // Will ocassionaly happen in 1.2, especially when printing. 0N/A // paint forcing use of the double buffer. This is used for historical 0N/A // reasons: JViewport, when scrolling, previously directly invoked paint 0N/A // while turning off double buffering at the RepaintManager level, this 0N/A // codes simulates that. 0N/A * Returns true if this component, or any of its ancestors, are in 0N/A * the processing of painting. 0N/A * Invoke this method to print the component. This method invokes 0N/A * <code>print</code> on the component. 0N/A * @param g the <code>Graphics</code> context in which to paint 0N/A * @see #printComponent 0N/A * @see #printChildren 0N/A * Invoke this method to print the component to the specified 0N/A * <code>Graphics</code>. This method will result in invocations 0N/A * of <code>printComponent</code>, <code>printBorder</code> and 0N/A * <code>printChildren</code>. It is recommended that you override 0N/A * one of the previously mentioned methods rather than this one if 0N/A * your intention is to customize the way printing looks. However, 0N/A * it can be useful to override this method should you want to prepare 0N/A * state before invoking the superclass behavior. As an example, 0N/A * if you wanted to change the component's background color before 0N/A * printing, you could do the following: 0N/A * public void print(Graphics g) { 0N/A * Color orig = getBackground(); 0N/A * setBackground(Color.WHITE); 0N/A * setBackground(orig); 0N/A * Alternatively, or for components that delegate painting to other objects, 0N/A * you can query during painting whether or not the component is in the 0N/A * midst of a print operation. The <code>isPaintingForPrint</code> method provides 0N/A * this ability and its return value will be changed by this method: to 0N/A * <code>true</code> immediately before rendering and to <code>false</code> 0N/A * immediately after. With each change a property change event is fired on 0N/A * this component with the name <code>"paintingForPrint"</code>. 0N/A * This method sets the component's state such that the double buffer 0N/A * will not be used: painting will be done directly on the passed in 0N/A * <code>Graphics</code>. 0N/A * @param g the <code>Graphics</code> context in which to paint 0N/A * @see #printComponent 0N/A * @see #printChildren 0N/A * @see #isPaintingForPrint 0N/A * This is invoked during a printing operation. This is implemented to 0N/A * invoke <code>paintComponent</code> on the component. Override this 0N/A * if you wish to add special painting behavior when printing. 0N/A * @param g the <code>Graphics</code> context in which to paint 0N/A * Prints this component's children. This is implemented to invoke 0N/A * <code>paintChildren</code> on the component. Override this if you 0N/A * wish to print the children differently than painting. 0N/A * @param g the <code>Graphics</code> context in which to paint 0N/A * Prints the component's border. This is implemented to invoke 0N/A * <code>paintBorder</code> on the component. Override this if you 0N/A * wish to print the border differently that it is painted. 0N/A * @param g the <code>Graphics</code> context in which to paint 0N/A * Returns true if the component is currently painting a tile. 0N/A * If this method returns true, paint will be called again for another 0N/A * tile. This method returns false if you are not painting a tile or 0N/A * if the last tile is painted. 0N/A * Use this method to keep some state you might need between tiles. 0N/A * @return true if the component is currently painting a tile, 0N/A * Returns <code>true</code> if the current painting operation on this 0N/A * component is part of a <code>print</code> operation. This method is 0N/A * useful when you want to customize what you print versus what you show 0N/A * You can detect changes in the value of this property by listening for 0N/A * property change events on this component with name 0N/A * <code>"paintingForPrint"</code>. 0N/A * Note: This method provides complimentary functionality to that provided 0N/A * by other high level Swing printing APIs. However, it deals strictly with 0N/A * painting and should not be confused as providing information on higher 0N/A * level print processes. For example, a {@link javax.swing.JTable#print()} 0N/A * operation doesn't necessarily result in a continuous rendering of the 0N/A * full component, and the return value of this method can change multiple 0N/A * times during that operation. It is even possible for the component to be 0N/A * painted to the screen while the printing process is ongoing. In such a 0N/A * case, the return value of this method is <code>true</code> when, and only 0N/A * when, the table is being painted as part of the printing process. 0N/A * @return true if the current painting operation on this component 0N/A * is part of a print operation 0N/A * In release 1.4, the focus subsystem was rearchitected. 0N/A * For more information, see 0N/A * How to Use the Focus Subsystem</a>, 0N/A * a section in <em>The Java Tutorial</em>. 0N/A * Changes this <code>JComponent</code>'s focus traversal keys to 0N/A * CTRL+TAB and CTRL+SHIFT+TAB. Also prevents 0N/A * <code>SortingFocusTraversalPolicy</code> from considering descendants 0N/A * of this JComponent when computing a focus traversal cycle. 0N/A * @see java.awt.Component#setFocusTraversalKeys 0N/A * @see SortingFocusTraversalPolicy 0N/A * @deprecated As of 1.4, replaced by 0N/A * <code>Component.setFocusTraversalKeys(int, Set)</code> and 0N/A * <code>Container.setFocusCycleRoot(boolean)</code>. 0N/A * In release 1.4, the focus subsystem was rearchitected. 0N/A * For more information, see 0N/A * How to Use the Focus Subsystem</a>, 0N/A * a section in <em>The Java Tutorial</em>. 0N/A * Overrides the default <code>FocusTraversalPolicy</code> for this 0N/A * <code>JComponent</code>'s focus traversal cycle by unconditionally 0N/A * setting the specified <code>Component</code> as the next 0N/A * <code>Component</code> in the cycle, and this <code>JComponent</code> 0N/A * as the specified <code>Component</code>'s previous 0N/A * <code>Component</code> in the cycle. 0N/A * @param aComponent the <code>Component</code> that should follow this 0N/A * <code>JComponent</code> in the focus traversal cycle 0N/A * @see #getNextFocusableComponent 0N/A * @see java.awt.FocusTraversalPolicy 0N/A * @deprecated As of 1.4, replaced by <code>FocusTraversalPolicy</code> 0N/A * In release 1.4, the focus subsystem was rearchitected. 0N/A * For more information, see 0N/A * How to Use the Focus Subsystem</a>, 0N/A * a section in <em>The Java Tutorial</em>. 0N/A * Returns the <code>Component</code> set by a prior call to 0N/A * <code>setNextFocusableComponent(Component)</code> on this 0N/A * <code>JComponent</code>. 0N/A * @return the <code>Component</code> that will follow this 0N/A * <code>JComponent</code> in the focus traversal cycle, or 0N/A * <code>null</code> if none has been explicitly specified 0N/A * @see #setNextFocusableComponent 0N/A * @deprecated As of 1.4, replaced by <code>FocusTraversalPolicy</code>. 0N/A * Provides a hint as to whether or not this <code>JComponent</code> 0N/A * should get focus. This is only a hint, and it is up to consumers that 0N/A * are requesting focus to honor this property. This is typically honored 0N/A * for mouse operations, but not keyboard operations. For example, look 0N/A * and feels could verify this property is true before requesting focus 0N/A * during a mouse operation. This would often times be used if you did 0N/A * not want a mouse press on a <code>JComponent</code> to steal focus, 0N/A * but did want the <code>JComponent</code> to be traversable via the 0N/A * keyboard. If you do not want this <code>JComponent</code> focusable at 0N/A * all, use the <code>setFocusable</code> method instead. 0N/A * How to Use the Focus Subsystem</a>, 0N/A * a section in <em>The Java Tutorial</em>, 0N/A * for more information. 0N/A * @param requestFocusEnabled indicates whether you want this 0N/A * <code>JComponent</code> to be focusable or not 0N/A * @see java.awt.Component#setFocusable 0N/A * Returns <code>true</code> if this <code>JComponent</code> should 0N/A * get focus; otherwise returns <code>false</code>. 0N/A * How to Use the Focus Subsystem</a>, 0N/A * a section in <em>The Java Tutorial</em>, 0N/A * for more information. 0N/A * @return <code>true</code> if this component should get focus, 0N/A * otherwise returns <code>false</code> 0N/A * @see #setRequestFocusEnabled 0N/A * @see java.awt.Component#isFocusable 0N/A * Requests that this <code>Component</code> gets the input focus. 0N/A * Refer to {@link java.awt.Component#requestFocus() 0N/A * Component.requestFocus()} for a complete description of 0N/A * Note that the use of this method is discouraged because 0N/A * its behavior is platform dependent. Instead we recommend the 0N/A * use of {@link #requestFocusInWindow() requestFocusInWindow()}. 0N/A * If you would like more information on focus, see 0N/A * How to Use the Focus Subsystem</a>, 0N/A * a section in <em>The Java Tutorial</em>. 0N/A * @see java.awt.Component#requestFocusInWindow() 0N/A * @see java.awt.Component#requestFocusInWindow(boolean) 0N/A * Requests that this <code>Component</code> gets the input focus. 0N/A * Refer to {@link java.awt.Component#requestFocus(boolean) 0N/A * Component.requestFocus(boolean)} for a complete description of 0N/A * Note that the use of this method is discouraged because 0N/A * its behavior is platform dependent. Instead we recommend the 0N/A * use of {@link #requestFocusInWindow(boolean) 0N/A * requestFocusInWindow(boolean)}. 0N/A * If you would like more information on focus, see 0N/A * How to Use the Focus Subsystem</a>, 0N/A * a section in <em>The Java Tutorial</em>. 0N/A * @param temporary boolean indicating if the focus change is temporary 0N/A * @return <code>false</code> if the focus change request is guaranteed to 0N/A * fail; <code>true</code> if it is likely to succeed 0N/A * @see java.awt.Component#requestFocusInWindow() 0N/A * @see java.awt.Component#requestFocusInWindow(boolean) 0N/A * Requests that this <code>Component</code> gets the input focus. 0N/A * Refer to {@link java.awt.Component#requestFocusInWindow() 0N/A * Component.requestFocusInWindow()} for a complete description of 0N/A * If you would like more information on focus, see 0N/A * How to Use the Focus Subsystem</a>, 0N/A * a section in <em>The Java Tutorial</em>. 0N/A * @return <code>false</code> if the focus change request is guaranteed to 0N/A * fail; <code>true</code> if it is likely to succeed 0N/A * @see java.awt.Component#requestFocusInWindow() 0N/A * @see java.awt.Component#requestFocusInWindow(boolean) 0N/A * Requests that this <code>Component</code> gets the input focus. 0N/A * Refer to {@link java.awt.Component#requestFocusInWindow(boolean) 0N/A * Component.requestFocusInWindow(boolean)} for a complete description of 0N/A * If you would like more information on focus, see 0N/A * How to Use the Focus Subsystem</a>, 0N/A * a section in <em>The Java Tutorial</em>. 0N/A * @param temporary boolean indicating if the focus change is temporary 0N/A * @return <code>false</code> if the focus change request is guaranteed to 0N/A * fail; <code>true</code> if it is likely to succeed 0N/A * @see java.awt.Component#requestFocusInWindow() 0N/A * @see java.awt.Component#requestFocusInWindow(boolean) 0N/A * Requests that this Component get the input focus, and that this 0N/A * Component's top-level ancestor become the focused Window. This component 0N/A * must be displayable, visible, and focusable for the request to be 0N/A * This method is intended for use by focus implementations. Client code 0N/A * should not use this method; instead, it should use 0N/A * <code>requestFocusInWindow()</code>. 0N/A * @see #requestFocusInWindow() 0N/A * Sets the value to indicate whether input verifier for the 0N/A * current focus owner will be called before this component requests 0N/A * focus. The default is true. Set to false on components such as a 0N/A * Cancel button or a scrollbar, which should activate even if the 0N/A * input in the current focus owner is not "passed" by the input 0N/A * verifier for that component. 0N/A * @param verifyInputWhenFocusTarget value for the 0N/A * <code>verifyInputWhenFocusTarget</code> property 0N/A * @see InputVerifier 0N/A * @see #setInputVerifier 0N/A * @see #getInputVerifier 0N/A * @see #getVerifyInputWhenFocusTarget 0N/A * description: Whether the Component verifies input before accepting 0N/A * Returns the value that indicates whether the input verifier for the 0N/A * current focus owner will be called before this component requests 0N/A * @return value of the <code>verifyInputWhenFocusTarget</code> property 0N/A * @see InputVerifier 0N/A * @see #setInputVerifier 0N/A * @see #getInputVerifier 0N/A * @see #setVerifyInputWhenFocusTarget 0N/A * Gets the <code>FontMetrics</code> for the specified <code>Font</code>. 0N/A * @param font the font for which font metrics is to be 0N/A * @return the font metrics for <code>font</code> 0N/A * @throws NullPointerException if <code>font</code> is null 0N/A * Sets the preferred size of this component. 0N/A * If <code>preferredSize</code> is <code>null</code>, the UI will 0N/A * be asked for the preferred size. 0N/A * description: The preferred size of the component. 0N/A * If the <code>preferredSize</code> has been set to a 0N/A * non-<code>null</code> value just returns it. 0N/A * If the UI delegate's <code>getPreferredSize</code> 0N/A * method returns a non <code>null</code> value then return that; 0N/A * otherwise defer to the component's layout manager. 0N/A * @return the value of the <code>preferredSize</code> property 0N/A * @see #setPreferredSize 0N/A * Sets the maximum size of this component to a constant 0N/A * value. Subsequent calls to <code>getMaximumSize</code> will always 0N/A * return this value; the component's UI will not be asked 0N/A * to compute it. Setting the maximum size to <code>null</code> 0N/A * restores the default behavior. 0N/A * @param maximumSize a <code>Dimension</code> containing the 0N/A * desired maximum allowable size 0N/A * @see #getMaximumSize 0N/A * description: The maximum size of the component. 0N/A * If the maximum size has been set to a non-<code>null</code> value 0N/A * just returns it. If the UI delegate's <code>getMaximumSize</code> 0N/A * method returns a non-<code>null</code> value then return that; 0N/A * otherwise defer to the component's layout manager. 0N/A * @return the value of the <code>maximumSize</code> property 0N/A * @see #setMaximumSize 0N/A * Sets the minimum size of this component to a constant 0N/A * value. Subsequent calls to <code>getMinimumSize</code> will always 0N/A * return this value; the component's UI will not be asked 0N/A * to compute it. Setting the minimum size to <code>null</code> 0N/A * restores the default behavior. 0N/A * @param minimumSize the new minimum size of this component 0N/A * @see #getMinimumSize 0N/A * description: The minimum size of the component. 0N/A * If the minimum size has been set to a non-<code>null</code> value 0N/A * just returns it. If the UI delegate's <code>getMinimumSize</code> 0N/A * method returns a non-<code>null</code> value then return that; otherwise 0N/A * defer to the component's layout manager. 0N/A * @return the value of the <code>minimumSize</code> property 0N/A * @see #setMinimumSize 0N/A * Gives the UI delegate an opportunity to define the precise 0N/A * shape of this component for the sake of mouse processing. 0N/A * @return true if this component logically contains x,y 0N/A * @see java.awt.Component#contains(int, int) 0N/A * Sets the border of this component. The <code>Border</code> object is 0N/A * responsible for defining the insets for the component 0N/A * (overriding any insets set directly on the component) and 0N/A * for optionally rendering any border decorations within the 0N/A * bounds of those insets. Borders should be used (rather 0N/A * than insets) for creating both decorative and non-decorative 0N/A * (such as margins and padding) regions for a swing component. 0N/A * Compound borders can be used to nest multiple borders within a 0N/A * Although technically you can set the border on any object 0N/A * that inherits from <code>JComponent</code>, the look and 0N/A * feel implementation of many standard Swing components 0N/A * doesn't work well with user-set borders. In general, 0N/A * when you want to set a border on a standard Swing 0N/A * component other than <code>JPanel</code> or <code>JLabel</code>, 0N/A * we recommend that you put the component in a <code>JPanel</code> 0N/A * and set the border on the <code>JPanel</code>. 0N/A * This is a bound property. 0N/A * @param border the border to be rendered for this component 0N/A * @see CompoundBorder 0N/A * attribute: visualUpdate true 0N/A * description: The component's border. 0N/A * Returns the border of this component or <code>null</code> if no 0N/A * border is currently set. 0N/A * @return the border object for this component 0N/A * If a border has been set on this component, returns the 0N/A * border's insets; otherwise calls <code>super.getInsets</code>. 0N/A * @return the value of the insets property 0N/A * Returns an <code>Insets</code> object containing this component's inset 0N/A * values. The passed-in <code>Insets</code> object will be reused 0N/A * Calling methods cannot assume that the same object will be returned, 0N/A * however. All existing values within this object are overwritten. 0N/A * If <code>insets</code> is null, this will allocate a new one. 0N/A * @param insets the <code>Insets</code> object, which can be reused 0N/A * @return the <code>Insets</code> object 0N/A // Can't reuse border insets because the Border interface 0N/A // can't be enhanced. 0N/A // super.getInsets() always returns an Insets object with 0N/A // all of its value zeroed. No need for a new object here. 0N/A * Overrides <code>Container.getAlignmentY</code> to return 0N/A * the horizontal alignment. 0N/A * @return the value of the <code>alignmentY</code> property 0N/A * @see #setAlignmentY 0N/A * @see java.awt.Component#getAlignmentY 0N/A * Sets the the horizontal alignment. 0N/A * @param alignmentY the new horizontal alignment 0N/A * @see #getAlignmentY 0N/A * description: The preferred vertical alignment of the component. 0N/A * Overrides <code>Container.getAlignmentX</code> to return 0N/A * the vertical alignment. 0N/A * @return the value of the <code>alignmentX</code> property 0N/A * @see #setAlignmentX 0N/A * @see java.awt.Component#getAlignmentX 0N/A * Sets the the vertical alignment. 0N/A * @param alignmentX the new vertical alignment 0N/A * @see #getAlignmentX 0N/A * description: The preferred horizontal alignment of the component. 0N/A * Sets the input verifier for this component. 0N/A * @param inputVerifier the new input verifier 0N/A * @see InputVerifier 0N/A * description: The component's input verifier. 0N/A * Returns the input verifier for this component. 0N/A * @return the <code>inputVerifier</code> property 0N/A * @see InputVerifier 0N/A * Returns this component's graphics context, which lets you draw 0N/A * on a component. Use this method to get a <code>Graphics</code> object and 0N/A * then invoke operations on that object to draw on the component. 0N/A * @return this components graphics context 0N/A /** Enables or disables diagnostic information about every graphics 0N/A * operation performed within the component or one of its children. 0N/A * @param debugOptions determines how the component should display 0N/A * the information; one of the following options: 0N/A * <li>DebugGraphics.LOG_OPTION - causes a text message to be printed. 0N/A * <li>DebugGraphics.FLASH_OPTION - causes the drawing to flash several 0N/A * <li>DebugGraphics.BUFFERED_OPTION - creates an 0N/A * <code>ExternalWindow</code> that displays the operations 0N/A * performed on the View's offscreen buffer. 0N/A * <li>DebugGraphics.NONE_OPTION disables debugging. 0N/A * <li>A value of 0 causes no changes to the debugging options. 0N/A * <code>debugOptions</code> is bitwise OR'd into the current value 0N/A * enum: NONE_OPTION DebugGraphics.NONE_OPTION 0N/A * LOG_OPTION DebugGraphics.LOG_OPTION 0N/A * FLASH_OPTION DebugGraphics.FLASH_OPTION 0N/A * BUFFERED_OPTION DebugGraphics.BUFFERED_OPTION 0N/A * description: Diagnostic options for graphics operations. 0N/A /** Returns the state of graphics debugging. 0N/A * @return a bitwise OR'd flag of zero or more of the following options: 0N/A * <li>DebugGraphics.LOG_OPTION - causes a text message to be printed. 0N/A * <li>DebugGraphics.FLASH_OPTION - causes the drawing to flash several 0N/A * <li>DebugGraphics.BUFFERED_OPTION - creates an 0N/A * <code>ExternalWindow</code> that displays the operations 0N/A * performed on the View's offscreen buffer. 0N/A * <li>DebugGraphics.NONE_OPTION disables debugging. 0N/A * <li>A value of 0 causes no changes to the debugging options. 0N/A * @see #setDebugGraphicsOptions 0N/A * Returns true if debug information is enabled for this 0N/A * <code>JComponent</code> or one of its parents. 0N/A * This method is now obsolete, please use a combination of 0N/A * <code>getActionMap()</code> and <code>getInputMap()</code> for 0N/A * similiar behavior. For example, to bind the <code>KeyStroke</code> 0N/A * <code>aKeyStroke</code> to the <code>Action</code> <code>anAction</code> 0N/A * component.getInputMap().put(aKeyStroke, aCommand); 0N/A * component.getActionMap().put(aCommmand, anAction); 0N/A * The above assumes you want the binding to be applicable for 0N/A * <code>WHEN_FOCUSED</code>. To register bindings for other focus 0N/A * states use the <code>getInputMap</code> method that takes an integer. 0N/A * Register a new keyboard action. 0N/A * <code>anAction</code> will be invoked if a key event matching 0N/A * <code>aKeyStroke</code> occurs and <code>aCondition</code> is verified. 0N/A * The <code>KeyStroke</code> object defines a 0N/A * particular combination of a keyboard key and one or more modifiers 0N/A * (alt, shift, ctrl, meta). 0N/A * The <code>aCommand</code> will be set in the delivered event if 0N/A * The <code>aCondition</code> can be one of: 0N/A * <DD>The action will be invoked only when the keystroke occurs 0N/A * while the component has the focus. 0N/A * <DT>WHEN_IN_FOCUSED_WINDOW 0N/A * <DD>The action will be invoked when the keystroke occurs while 0N/A * the component has the focus or if the component is in the 0N/A * window that has the focus. Note that the component need not 0N/A * be an immediate descendent of the window -- it can be 0N/A * anywhere in the window's containment hierarchy. In other 0N/A * words, whenever <em>any</em> component in the window has the focus, 0N/A * the action registered with this component is invoked. 0N/A * <DT>WHEN_ANCESTOR_OF_FOCUSED_COMPONENT 0N/A * <DD>The action will be invoked when the keystroke occurs while the 0N/A * component has the focus or if the component is an ancestor of 0N/A * the component that has the focus. 0N/A * The combination of keystrokes and conditions lets you define high 0N/A * level (semantic) action events for a specified keystroke+modifier 0N/A * combination (using the KeyStroke class) and direct to a parent or 0N/A * child of a component that has the focus, or to the component itself. 0N/A * In other words, in any hierarchical structure of components, an 0N/A * arbitrary key-combination can be immediately directed to the 0N/A * appropriate component in the hierarchy, and cause a specific method 0N/A * to be invoked (usually by way of adapter objects). 0N/A * If an action has already been registered for the receiving 0N/A * container, with the same charCode and the same modifiers, 0N/A * <code>anAction</code> will replace the action. 0N/A * @param anAction the <code>Action</code> to be registered 0N/A * @param aCommand the command to be set in the delivered event 0N/A * @param aKeyStroke the <code>KeyStroke</code> to bind to the action 0N/A * @param aCondition the condition that needs to be met, see above 0N/A * Registers any bound <code>WHEN_IN_FOCUSED_WINDOW</code> actions with 0N/A * the <code>KeyboardManager</code>. If <code>onlyIfNew</code> 0N/A * is true only actions that haven't been registered are pushed 0N/A * to the <code>KeyboardManager</code>; 0N/A * otherwise all actions are pushed to the <code>KeyboardManager</code>. 0N/A * @param onlyIfNew if true, only actions that haven't been registered 0N/A * are pushed to the <code>KeyboardManager</code> 0N/A // Push any new KeyStrokes to the KeyboardManager. 0N/A // Remove any old ones. 0N/A // Updated the registered Hashtable. 0N/A * Unregisters all the previously registered 0N/A * <code>WHEN_IN_FOCUSED_WINDOW</code> <code>KeyStroke</code> bindings. 0N/A * Invoked from <code>ComponentInputMap</code> when its bindings change. 0N/A * If <code>inputMap</code> is the current <code>windowInputMap</code> 0N/A * (or a parent of the window <code>InputMap</code>) 0N/A * the <code>KeyboardManager</code> is notified of the new bindings. 0N/A * @param inputMap the map containing the new bindings 0N/A * This method is now obsolete, please use a combination of 0N/A * <code>getActionMap()</code> and <code>getInputMap()</code> for 0N/A * similiar behavior. 0N/A * This method is now obsolete. To unregister an existing binding 0N/A * you can either remove the binding from the 0N/A * <code>InputMap</code>. Removing the binding from the 0N/A * <code>InputMap</code> allows bindings in parent <code>InputMap</code>s 0N/A * to be active, whereas putting a dummy binding in the 0N/A * <code>InputMap</code> effectively disables 0N/A * the binding from ever happening. 0N/A * Unregisters a keyboard action. 0N/A * This will remove the binding from the <code>ActionMap</code> 0N/A * (if it exists) as well as the <code>InputMap</code>s. 0N/A * Returns the <code>KeyStrokes</code> that will initiate 0N/A * registered actions. 0N/A * @return an array of <code>KeyStroke</code> objects 0N/A * @see #registerKeyboardAction 0N/A * Returns the condition that determines whether a registered action 0N/A * occurs in response to the specified keystroke. 0N/A * For Java 2 platform v1.3, a <code>KeyStroke</code> can be associated 0N/A * with more than one condition. 0N/A * For example, 'a' could be bound for the two 0N/A * conditions <code>WHEN_FOCUSED</code> and 0N/A * <code>WHEN_IN_FOCUSED_WINDOW</code> condition. 0N/A * @return the action-keystroke condition 0N/A * Returns the object that will perform the action registered for a 0N/A * @return the <code>ActionListener</code> 0N/A * object invoked when the keystroke occurs 0N/A * Unregisters all the bindings in the first tier <code>InputMaps</code> 0N/A * and <code>ActionMap</code>. This has the effect of removing any 0N/A * local bindings, and allowing the bindings defined in parent 0N/A * (the UI is usually defined in the second tier) to persist. 0N/A * Sets the <code>InputMap</code> to use under the condition 0N/A * <code>condition</code> to 0N/A * <code>map</code>. A <code>null</code> value implies you 0N/A * do not want any bindings to be used, even from the UI. This will 0N/A * not reinstall the UI <code>InputMap</code> (if there was one). 0N/A * <code>condition</code> has one of the following values: 0N/A * <li><code>WHEN_IN_FOCUSED_WINDOW</code> 0N/A * <li><code>WHEN_FOCUSED</code> 0N/A * <li><code>WHEN_ANCESTOR_OF_FOCUSED_COMPONENT</code> 0N/A * If <code>condition</code> is <code>WHEN_IN_FOCUSED_WINDOW</code> 0N/A * and <code>map</code> is not a <code>ComponentInputMap</code>, an 0N/A * <code>IllegalArgumentException</code> will be thrown. 0N/A * Similarly, if <code>condition</code> is not one of the values 0N/A * listed, an <code>IllegalArgumentException</code> will be thrown. 0N/A * @param condition one of the values listed above 0N/A * @param map the <code>InputMap</code> to use for the given condition 0N/A * @exception IllegalArgumentException if <code>condition</code> is 0N/A * <code>WHEN_IN_FOCUSED_WINDOW</code> and <code>map</code> 0N/A * is not an instance of <code>ComponentInputMap</code>; or 0N/A * if <code>condition</code> is not one of the legal values 0N/A throw new IllegalArgumentException(
"condition must be one of JComponent.WHEN_IN_FOCUSED_WINDOW, JComponent.WHEN_FOCUSED or JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT");
0N/A * Returns the <code>InputMap</code> that is used during 0N/A * <code>condition</code>. 0N/A * @param condition one of WHEN_IN_FOCUSED_WINDOW, WHEN_FOCUSED, 0N/A * WHEN_ANCESTOR_OF_FOCUSED_COMPONENT 0N/A * @return the <code>InputMap</code> for the specified 0N/A * <code>condition</code> 0N/A * Returns the <code>InputMap</code> that is used when the 0N/A * component has focus. 0N/A * This is convenience method for <code>getInputMap(WHEN_FOCUSED)</code>. 0N/A * @return the <code>InputMap</code> used when the component has focus 0N/A * Sets the <code>ActionMap</code> to <code>am</code>. This does not set 0N/A * the parent of the <code>am</code> to be the <code>ActionMap</code> 0N/A * from the UI (if there was one), it is up to the caller to have done this. 0N/A * @param am the new <code>ActionMap</code> 0N/A * Returns the <code>ActionMap</code> used to determine what 0N/A * <code>Action</code> to fire for particular <code>KeyStroke</code> 0N/A * binding. The returned <code>ActionMap</code>, unless otherwise 0N/A * set, will have the <code>ActionMap</code> from the UI set as the parent. 0N/A * @return the <code>ActionMap</code> containing the key/action bindings 0N/A * Returns the <code>InputMap</code> to use for condition 0N/A * <code>condition</code>. If the <code>InputMap</code> hasn't 0N/A * been created, and <code>create</code> is 0N/A * true, it will be created. 0N/A * @param condition one of the following values: 0N/A * <li>JComponent.FOCUS_INPUTMAP_CREATED 0N/A * <li>JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT 0N/A * <li>JComponent.WHEN_IN_FOCUSED_WINDOW 0N/A * @param create if true, create the <code>InputMap</code> if it 0N/A * is not already created 0N/A * @return the <code>InputMap</code> for the given <code>condition</code>; 0N/A * if <code>create</code> is false and the <code>InputMap</code> 0N/A * hasn't been created, returns <code>null</code> 0N/A * @exception IllegalArgumentException if <code>condition</code> 0N/A * is not one of the legal values listed above 0N/A // Hasn't been created yet. 0N/A // Hasn't been created yet. 0N/A // Hasn't been created yet. 0N/A throw new IllegalArgumentException(
"condition must be one of JComponent.WHEN_IN_FOCUSED_WINDOW, JComponent.WHEN_FOCUSED or JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT");
0N/A * Finds and returns the appropriate <code>ActionMap</code>. 0N/A * @param create if true, create the <code>ActionMap</code> if it 0N/A * is not already created 0N/A * @return the <code>ActionMap</code> for this component; if the 0N/A * <code>create</code> flag is false and there is no 0N/A * current <code>ActionMap</code>, returns <code>null</code> 0N/A // Hasn't been created. 0N/A * Returns the baseline. The baseline is measured from the top of 0N/A * the component. This method is primarily meant for 0N/A * <code>LayoutManager</code>s to align components along their 0N/A * baseline. A return value less than 0 indicates this component 0N/A * does not have a reasonable baseline and that 0N/A * <code>LayoutManager</code>s should not align this component on 0N/A * This method calls into the <code>ComponentUI</code> method of the 0N/A * same name. If this component does not have a <code>ComponentUI</code> 0N/A * -1 will be returned. If a value >= 0 is 0N/A * returned, then the component has a valid baseline for any 0N/A * size >= the minimum size and <code>getBaselineResizeBehavior</code> 0N/A * can be used to determine how the baseline changes with size. 0N/A * @throws IllegalArgumentException {@inheritDoc} 0N/A * @see #getBaselineResizeBehavior 0N/A * @see java.awt.FontMetrics 0N/A * Returns an enum indicating how the baseline of the component 0N/A * changes as the size changes. This method is primarily meant for 0N/A * layout managers and GUI builders. 0N/A * This method calls into the <code>ComponentUI</code> method of 0N/A * the same name. If this component does not have a 0N/A * <code>ComponentUI</code> 0N/A * <code>BaselineResizeBehavior.OTHER</code> will be 0N/A * returned. Subclasses should 0N/A * never return <code>null</code>; if the baseline can not be 0N/A * calculated return <code>BaselineResizeBehavior.OTHER</code>. Callers 0N/A * should first ask for the baseline using 0N/A * <code>getBaseline</code> and if a value >= 0 is returned use 0N/A * this method. It is acceptable for this method to return a 0N/A * value other than <code>BaselineResizeBehavior.OTHER</code> even if 0N/A * <code>getBaseline</code> returns a value less than 0. 0N/A * @see #getBaseline(int, int) 0N/A * In release 1.4, the focus subsystem was rearchitected. 0N/A * For more information, see 0N/A * How to Use the Focus Subsystem</a>, 0N/A * a section in <em>The Java Tutorial</em>. 0N/A * Requests focus on this <code>JComponent</code>'s 0N/A * <code>FocusTraversalPolicy</code>'s default <code>Component</code>. 0N/A * If this <code>JComponent</code> is a focus cycle root, then its 0N/A * <code>FocusTraversalPolicy</code> is used. Otherwise, the 0N/A * <code>FocusTraversalPolicy</code> of this <code>JComponent</code>'s 0N/A * focus-cycle-root ancestor is used. 0N/A * @see java.awt.FocusTraversalPolicy#getDefaultComponent 0N/A * @deprecated As of 1.4, replaced by 0N/A * <code>FocusTraversalPolicy.getDefaultComponent(Container).requestFocus()</code> 0N/A * Makes the component visible or invisible. 0N/A * Overrides <code>Component.setVisible</code>. 0N/A * @param aFlag true to make the component visible; false to 0N/A * attribute: visualUpdate true 0N/A // Some (all should) LayoutManagers do not consider components 0N/A // that are not visible. As such we need to revalidate when the 0N/A // visible bit changes. 0N/A * Sets whether or not this component is enabled. 0N/A * A component that is enabled may respond to user input, 0N/A * while a component that is not enabled cannot respond to 0N/A * user input. Some components may alter their visual 0N/A * representation when they are disabled in order to 0N/A * provide feedback to the user that they cannot take input. 0N/A * <p>Note: Disabling a component does not disable its children. 0N/A * <p>Note: Disabling a lightweight component does not prevent it from 0N/A * receiving MouseEvents. 0N/A * @param enabled true if this component should be enabled, false otherwise 0N/A * @see java.awt.Component#isEnabled 0N/A * @see java.awt.Component#isLightweight 0N/A * attribute: visualUpdate true 0N/A * description: The enabled state of the component. 0N/A * Sets the foreground color of this component. It is up to the 0N/A * look and feel to honor this property, some may choose to ignore 0N/A * @param fg the desired foreground <code>Color</code> 0N/A * @see java.awt.Component#getForeground 0N/A * attribute: visualUpdate true 0N/A * description: The foreground color of the component. 0N/A // foreground already bound in AWT1.2 0N/A * Sets the background color of this component. The background 0N/A * color is used only if the component is opaque, and only 0N/A * by subclasses of <code>JComponent</code> or 0N/A * <code>ComponentUI</code> implementations. Direct subclasses of 0N/A * <code>JComponent</code> must override 0N/A * <code>paintComponent</code> to honor this property. 0N/A * It is up to the look and feel to honor this property, some may 0N/A * choose to ignore it. 0N/A * @param bg the desired background <code>Color</code> 0N/A * @see java.awt.Component#getBackground 0N/A * attribute: visualUpdate true 0N/A * description: The background color of the component. 0N/A // background already bound in AWT1.2 0N/A * Sets the font for this component. 0N/A * @param font the desired <code>Font</code> for this component 0N/A * @see java.awt.Component#getFont 0N/A * attribute: visualUpdate true 0N/A * description: The font for the component. 0N/A // font already bound in AWT1.2 0N/A * Returns the default locale used to initialize each JComponent's 0N/A * locale property upon creation. 0N/A * The default locale has "AppContext" scope so that applets (and 0N/A * potentially multiple lightweight applications running in a single VM) 0N/A * can have their own setting. An applet can safely alter its default 0N/A * locale because it will have no affect on other applets (or the browser). 0N/A * @return the default <code>Locale</code>. 0N/A * @see #setDefaultLocale 0N/A * @see java.awt.Component#getLocale 0N/A //REMIND(bcb) choosing the default value is more complicated 0N/A * Sets the default locale used to initialize each JComponent's locale 0N/A * property upon creation. The initial value is the VM's default locale. 0N/A * The default locale has "AppContext" scope so that applets (and 0N/A * potentially multiple lightweight applications running in a single VM) 0N/A * can have their own setting. An applet can safely alter its default 0N/A * locale because it will have no affect on other applets (or the browser). 0N/A * @param l the desired default <code>Locale</code> for new components. 0N/A * @see #getDefaultLocale 0N/A * @see java.awt.Component#getLocale 0N/A * Processes any key events that the component itself 0N/A * recognizes. This is called after the focus 0N/A * manager and any interested listeners have been 0N/A * given a chance to steal away the event. This 0N/A * method is called only if the event has not 0N/A * yet been consumed. This method is called prior 0N/A * to the keyboard UI logic. 0N/A * This method is implemented to do nothing. Subclasses would 0N/A * normally override this method if they process some 0N/A * key events themselves. If the event is processed, 0N/A * it should be consumed. 0N/A /** Overrides <code>processKeyEvent</code> to process events. **/ 0N/A // This gives the key event listeners a crack at the event 0N/A // give the component itself a crack at the event 0N/A * Invoked to process the key bindings for <code>ks</code> as the result 0N/A * of the <code>KeyEvent</code> <code>e</code>. This obtains 0N/A * the appropriate <code>InputMap</code>, 0N/A * gets the binding, gets the action from the <code>ActionMap</code>, 0N/A * and then (if the action is found and the component 0N/A * is enabled) invokes <code>notifyAction</code> to notify the action. 0N/A * @param ks the <code>KeyStroke</code> queried 0N/A * @param e the <code>KeyEvent</code> 0N/A * @param condition one of the following values: 0N/A * <li>JComponent.WHEN_FOCUSED 0N/A * <li>JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT 0N/A * <li>JComponent.WHEN_IN_FOCUSED_WINDOW 0N/A * @param pressed true if the key is pressed 0N/A * @return true if there was a binding to an action, and the action 0N/A * This is invoked as the result of a <code>KeyEvent</code> 0N/A * that was not consumed by the <code>FocusManager</code>, 0N/A * <code>KeyListeners</code>, or the component. It will first try 0N/A * <code>WHEN_FOCUSED</code> bindings, 0N/A * then <code>WHEN_ANCESTOR_OF_FOCUSED_COMPONENT</code> bindings, 0N/A * and finally <code>WHEN_IN_FOCUSED_WINDOW</code> bindings. 0N/A * @param e the unconsumed <code>KeyEvent</code> 0N/A * @param pressed true if the key is pressed 0N/A * @return true if there is a key binding for <code>e</code> 0N/A // Get the KeyStroke 1067N/A // There may be two keystrokes associated with a low-level key event; 1067N/A // in this case a keystroke made of an extended key code has a priority. 1067N/A // Do we have a key binding for e? 1067N/A // If we have a binding by an extended code, use it. 1067N/A // If not, check for regular code binding. 0N/A /* We have no key binding. Let's try the path from our parent to the 0N/A * window excluded. We store the path components so we can avoid 0N/A * asking the same component twice. 0N/A // This is done so that the children of a JInternalFrame are 0N/A // given precedence for WHEN_IN_FOCUSED_WINDOW bindings before 0N/A // other components WHEN_IN_FOCUSED_WINDOW bindings. This also gives 0N/A // more precedence to the WHEN_IN_FOCUSED_WINDOW bindings of the 0N/A // JInternalFrame's children vs the 0N/A // WHEN_ANCESTOR_OF_FOCUSED_COMPONENT bindings of the parents. 0N/A // maybe generalize from JInternalFrame (like isFocusCycleRoot). 0N/A /* No components between the focused component and the window is 0N/A * actually interested by the key event. Let's try the other 0N/A * JComponent in this window. 0N/A * Registers the text to display in a tool tip. 0N/A * The text displays when the cursor lingers over the component. 0N/A * in <em>The Java Tutorial</em> 0N/A * for further documentation. 0N/A * @param text the string to display; if the text is <code>null</code>, 0N/A * the tool tip is turned off for this component 0N/A * @see #TOOL_TIP_TEXT_KEY 0N/A * description: The text to display in a tool tip. 0N/A * Returns the tooltip string that has been set with 0N/A * <code>setToolTipText</code>. 0N/A * @return the text of the tool tip 0N/A * @see #TOOL_TIP_TEXT_KEY 0N/A * Returns the string to be used as the tooltip for <i>event</i>. 0N/A * By default this returns any string set using 0N/A * <code>setToolTipText</code>. If a component provides 0N/A * more extensive API to support differing tooltips at different locations, 0N/A * this method should be overridden. 0N/A * Returns the tooltip location in this component's coordinate system. 0N/A * If <code>null</code> is returned, Swing will choose a location. 0N/A * The default implementation returns <code>null</code>. 0N/A * @param event the <code>MouseEvent</code> that caused the 0N/A * <code>ToolTipManager</code> to show the tooltip 0N/A * @return always returns <code>null</code> 0N/A * Returns the preferred location to display the popup menu in this 0N/A * component's coordinate system. It is up to the look and feel to 0N/A * honor this property, some may choose to ignore it. 0N/A * If {@code null}, the look and feel will choose a suitable location. 0N/A * @param event the {@code MouseEvent} that triggered the popup to be 0N/A * shown, or {@code null} if the popup is not being shown as the 0N/A * result of a mouse event 0N/A * @return location to display the {@code JPopupMenu}, or {@code null} 0N/A * Returns the instance of <code>JToolTip</code> that should be used 0N/A * to display the tooltip. 0N/A * Components typically would not override this method, 0N/A * but it can be used to 0N/A * cause different tooltips to be displayed differently. 0N/A * @return the <code>JToolTip</code> used to display this toolTip 0N/A * Forwards the <code>scrollRectToVisible()</code> message to the 0N/A * <code>JComponent</code>'s parent. Components that can service 0N/A * the request, such as <code>JViewport</code>, 0N/A * override this method and perform the scrolling. 0N/A * @param aRect the visible <code>Rectangle</code> 0N/A * Sets the <code>autoscrolls</code> property. 0N/A * If <code>true</code> mouse dragged events will be 0N/A * synthetically generated when the mouse is dragged 0N/A * outside of the component's bounds and mouse motion 0N/A * has paused (while the button continues to be held 0N/A * down). The synthetic events make it appear that the 0N/A * drag gesture has resumed in the direction established when 0N/A * the component's boundary was crossed. Components that 0N/A * support autoscrolling must handle <code>mouseDragged</code> 0N/A * events by calling <code>scrollRectToVisible</code> with a 0N/A * rectangle that contains the mouse event's location. All of 0N/A * the Swing components that support item selection and are 0N/A * typically displayed in a <code>JScrollPane</code> 0N/A * (<code>JTable</code>, <code>JList</code>, <code>JTree</code>, 0N/A * <code>JTextArea</code>, and <code>JEditorPane</code>) 0N/A * already handle mouse dragged events in this way. To enable 0N/A * autoscrolling in any other component, add a mouse motion 0N/A * listener that calls <code>scrollRectToVisible</code>. 0N/A * For example, given a <code>JPanel</code>, <code>myPanel</code>: 0N/A * MouseMotionListener doScrollRectToVisible = new MouseMotionAdapter() { 0N/A * public void mouseDragged(MouseEvent e) { 0N/A * Rectangle r = new Rectangle(e.getX(), e.getY(), 1, 1); 0N/A * ((JPanel)e.getSource()).scrollRectToVisible(r); 0N/A * myPanel.addMouseMotionListener(doScrollRectToVisible); 0N/A * The default value of the <code>autoScrolls</code> 0N/A * property is <code>false</code>. 0N/A * @param autoscrolls if true, synthetic mouse dragged events 0N/A * are generated when the mouse is dragged outside of a component's 0N/A * bounds and the mouse button continues to be held down; otherwise 0N/A * @see #getAutoscrolls 0N/A * description: Determines if this component automatically scrolls its contents when dragged. 0N/A * Gets the <code>autoscrolls</code> property. 0N/A * @return the value of the <code>autoscrolls</code> property 0N/A * @see #setAutoscrolls 0N/A * Sets the {@code TransferHandler}, which provides support for transfer 0N/A * and drop. This may be {@code null} if the component does not support 0N/A * data transfer operations. 0N/A * If the new {@code TransferHandler} is not {@code null}, this method 0N/A * also installs a <b>new</b> {@code DropTarget} on the component to 0N/A * activate drop handling through the {@code TransferHandler} and activate 0N/A * any built-in support (such as calculating and displaying potential drop 0N/A * locations). If you do not wish for this component to respond in any way 0N/A * to drops, you can disable drop support entirely either by removing the 0N/A * drop target ({@code setDropTarget(null)}) or by de-activating it 0N/A * ({@code getDropTaget().setActive(false)}). 0N/A * If the new {@code TransferHandler} is {@code null}, this method removes 0N/A * Under two circumstances, this method does not modify the drop target: 0N/A * First, if the existing drop target on this component was explicitly 0N/A * set by the developer to a {@code non-null} value. Second, if the 0N/A * system property {@code suppressSwingDropSupport} is {@code true}. The 0N/A * default value for the system property is {@code false}. 0N/A * How to Use Drag and Drop and Data Transfer</a>, 0N/A * a section in <em>The Java Tutorial</em>, for more information. 0N/A * @param newHandler the new {@code TransferHandler} 0N/A * @see TransferHandler 0N/A * @see #getTransferHandler 0N/A * description: Mechanism for transfer of data to and from the component 0N/A * Gets the <code>transferHandler</code> property. 0N/A * @return the value of the <code>transferHandler</code> property 0N/A * @see TransferHandler 0N/A * @see #setTransferHandler 0N/A * Calculates a custom drop location for this type of component, 0N/A * representing where a drop at the given point should insert data. 0N/A * <code>null</code> is returned if this component doesn't calculate 0N/A * custom drop locations. In this case, <code>TransferHandler</code> 0N/A * will provide a default <code>DropLocation</code> containing just 0N/A * @param p the point to calculate a drop location for 0N/A * @return the drop location, or <code>null</code> 0N/A * Called to set or clear the drop location during a DnD operation. 0N/A * In some cases, the component may need to use its internal selection 0N/A * temporarily to indicate the drop location. To help facilitate this, 0N/A * this method returns and accepts as a parameter a state object. 0N/A * This state object can be used to store, and later restore, the selection 0N/A * state. Whatever this method returns will be passed back to it in 0N/A * future calls, as the state parameter. If it wants the DnD system to 0N/A * continue storing the same state, it must pass it back every time. 0N/A * Here's how this is used: 0N/A * Let's say that on the first call to this method the component decides 0N/A * to save some state (because it is about to use the selection to show 0N/A * a drop index). It can return a state object to the caller encapsulating 0N/A * any saved selection state. On a second call, let's say the drop location 0N/A * is being changed to something else. The component doesn't need to 0N/A * restore anything yet, so it simply passes back the same state object 0N/A * to have the DnD system continue storing it. Finally, let's say this 0N/A * method is messaged with <code>null</code>. This means DnD 0N/A * is finished with this component for now, meaning it should restore 0N/A * state. At this point, it can use the state parameter to restore 0N/A * said state, and of course return <code>null</code> since there's 0N/A * no longer anything to store. 0N/A * @param location the drop location (as calculated by 0N/A * <code>dropLocationForPoint</code>) or <code>null</code> 0N/A * if there's no longer a valid drop location 0N/A * @param state the state object saved earlier for this component, 0N/A * or <code>null</code> 0N/A * @param forDrop whether or not the method is being called because an 0N/A * actual drop occurred 0N/A * @return any saved state for this component, or <code>null</code> if none 0N/A * Called to indicate to this component that DnD is done. 0N/A * Needed by <code>JTree</code>. 0N/A * Processes mouse events occurring on this component by 0N/A * dispatching them to any registered 0N/A * <code>MouseListener</code> objects, refer to 0N/A * {@link java.awt.Component#processMouseEvent(MouseEvent)} 0N/A * for a complete description of this method. 0N/A * @param e the mouse event 0N/A * @see java.awt.Component#processMouseEvent 0N/A * Processes mouse motion events, such as MouseEvent.MOUSE_DRAGGED. 0N/A * @param e the <code>MouseEvent</code> 0N/A // We don't want to do the drags when the mouse moves if we're 0N/A // autoscrolling. It makes it feel spastic. 0N/A // Inner classes can't get at this method from a super class 0N/A * This is invoked by the <code>RepaintManager</code> if 0N/A * <code>createImage</code> is called on the component. 0N/A * @param newValue true if the double buffer image was created from this component 0N/A * Returns true if the <code>RepaintManager</code> 0N/A * created the double buffer image from the component. 0N/A * @return true if this component had a double buffer image, false otherwise 0N/A * <code>ActionStandin</code> is used as a standin for 0N/A * <code>ActionListeners</code> that are 0N/A * added via <code>registerKeyboardAction</code>. 0N/A // This will be non-null if actionListener is an Action. 0N/A return "ActionStandin";
0N/A // This keeps the old semantics where 0N/A // registerKeyboardAction(null) would essentialy remove 0N/A // the binding. We don't remove the binding from the 0N/A // InputMap as that would still allow parent InputMaps 0N/A // bindings to be accessed. 0N/A // We don't allow any values to be added. 0N/A // Does nothing, our enabledness is determiend from our asociated 0N/A // This class is used by the KeyboardState class to provide a single 0N/A // instance that can be stored in the AppContext. 0N/A // Get the array of key codes from the AppContext. 0N/A * Updates internal state of the KeyboardState and returns true 0N/A * if the event should be processed further. 0N/A // We are forced to process VK_PRINTSCREEN separately because 0N/A // the Windows doesn't generate the key pressed event for 0N/A // printscreen and it block the processing of key release 0N/A // event for printscreen. 0N/A // Not a known KeyEvent type, bail. 0N/A // We're currently calling into the InputVerifier 0N/A // for this component, so allow the focus change. 0N/A // We're already in the InputVerifier for 0N/A // currentSource. By resetting the currentSource 0N/A // we ensure that if the InputVerifier for 0N/A // currentSource does a requestFocus, we don't 0N/A // try and run the InputVerifier again. 0N/A * --- Accessibility Support --- 0N/A * @deprecated As of JDK version 1.1, 0N/A * replaced by <code>java.awt.Component.setEnabled(boolean)</code>. 0N/A * @deprecated As of JDK version 1.1, 0N/A * replaced by <code>java.awt.Component.setEnabled(boolean)</code>. 0N/A * The <code>AccessibleContext</code> associated with this 0N/A * <code>JComponent</code>. 0N/A * Returns the <code>AccessibleContext</code> associated with this 0N/A * <code>JComponent</code>. The method implemented by this base 0N/A * class returns null. Classes that extend <code>JComponent</code> 0N/A * should implement this method to return the 0N/A * <code>AccessibleContext</code> associated with the subclass. 0N/A * @return the <code>AccessibleContext</code> of this 0N/A * <code>JComponent</code> 0N/A * Inner class of JComponent used to provide default support for 0N/A * accessibility. This class is not meant to be used directly by 0N/A * application developers, but is instead meant only to be 0N/A * subclassed by component developers. 0N/A * <strong>Warning:</strong> 0N/A * Serialized objects of this class will not be compatible with 0N/A * future Swing releases. The current serialization support is 0N/A * appropriate for short term storage or RMI between applications running 0N/A * the same version of Swing. As of 1.4, support for long term storage 0N/A * of all JavaBeans<sup><font size="-2">TM</font></sup> 0N/A * has been added to the <code>java.beans</code> package. 0N/A * Though the class is abstract, this should be called by 0N/A * Fire PropertyChange listener, if one is registered, 0N/A * Fire PropertyChange listener, if one is registered, 0N/A * when focus events happen 0N/A }
// inner class AccessibleFocusHandler 0N/A * Adds a PropertyChangeListener to the listener list. 0N/A * @param listener the PropertyChangeListener to be added 0N/A * Removes a PropertyChangeListener from the listener list. 0N/A * This removes a PropertyChangeListener that was registered 0N/A * for all properties. 0N/A * @param listener the PropertyChangeListener to be removed 0N/A * Recursively search through the border hierarchy (if it exists) 0N/A * for a TitledBorder with a non-null title. This does a depth 0N/A * first search on first the inside borders then the outside borders. 0N/A * The assumption is that titles make really pretty inside borders 0N/A * but not very pretty outside borders in compound border situations. 0N/A * It's rather arbitrary, but hopefully decent UI programmers will 0N/A * not create multiple titled borders for the same component. 0N/A // AccessibleContext methods 0N/A * Gets the accessible name of this object. This should almost never 0N/A * return java.awt.Component.getName(), as that generally isn't 0N/A * a localized name, and doesn't have meaning for the user. If the 0N/A * object is fundamentally a text object (such as a menu item), the 0N/A * accessible name should be the text of the object (for example, 0N/A * If the object has a tooltip, the tooltip text may also be an 0N/A * appropriate String to return. 0N/A * @return the localized name of the object -- can be null if this 0N/A * object does not have a name 0N/A * @see AccessibleContext#setAccessibleName 0N/A // fallback to the client name property 0N/A // fallback to the titled border if it exists 0N/A // fallback to the label labeling us if it exists 0N/A * Gets the accessible description of this object. This should be 0N/A * a concise, localized description of what this object is - what 0N/A * is its meaning to the user. If the object has a tooltip, the 0N/A * tooltip text may be an appropriate string to return, assuming 0N/A * it contains a concise description of the object (instead of just 0N/A * the name of the object - for example a "Save" icon on a toolbar that 0N/A * had "save" as the tooltip text shouldn't return the tooltip 0N/A * text as the description, but something like "Saves the current 0N/A * text document" instead). 0N/A * @return the localized description of the object -- can be null if 0N/A * this object does not have a description 0N/A * @see AccessibleContext#setAccessibleDescription 0N/A // fallback to the client description property 0N/A // fallback to the tool tip text if it exists 0N/A // Just in case the subclass overrode the 0N/A // getToolTipText method and actually 0N/A // requires a MouseEvent. 0N/A // [[[FIXME: WDW - we probably should require this 0N/A // method to take a MouseEvent and just pass it on 0N/A // to getToolTipText. The swing-feedback traffic 0N/A // leads me to believe getToolTipText might change, 0N/A // though, so I was hesitant to make this change at 0N/A // fallback to the label labeling us if it exists 0N/A * Gets the role of this object. 0N/A * @return an instance of AccessibleRole describing the role of the 0N/A * @see AccessibleRole 0N/A * Gets the state of this object. 0N/A * @return an instance of AccessibleStateSet containing the current 0N/A * state set of the object 0N/A * @see AccessibleState 0N/A * Returns the number of accessible children in the object. If all 0N/A * of the children of this object implement Accessible, than this 0N/A * method should return the number of children of this object. 0N/A * @return the number of accessible children in the object. 0N/A * Returns the nth Accessible child of the object. 0N/A * @param i zero-based index of child 0N/A * @return the nth Accessible child of the object 0N/A // ----- AccessibleExtendedComponent 0N/A * Returns the AccessibleExtendedComponent 0N/A * @return the AccessibleExtendedComponent 0N/A * Returns the tool tip text 0N/A * @return the tool tip text, if supported, of the object; 0N/A * Returns the titled border text 0N/A * @return the titled border text, if supported, of the object; 0N/A * Returns key bindings associated with this object 0N/A * @return the key bindings, if supported, of the object; 0N/A * @see AccessibleKeyBinding 0N/A }
// inner class AccessibleJComponent 0N/A * Returns an <code>ArrayTable</code> used for 0N/A * key/value "client properties" for this component. If the 0N/A * <code>clientProperties</code> table doesn't exist, an empty one 0N/A * @return an ArrayTable 0N/A * @see #putClientProperty 0N/A * @see #getClientProperty 0N/A * Returns the value of the property with the specified key. Only 0N/A * properties added with <code>putClientProperty</code> will return 0N/A * a non-<code>null</code> value. 0N/A * @param key the being queried 0N/A * @return the value of this property or <code>null</code> 0N/A * @see #putClientProperty 0N/A * Adds an arbitrary key/value "client property" to this component. 0N/A * to annotate components that were created by another module. 0N/A * layout manager might store per child constraints this way. For example: 0N/A * componentA.putClientProperty("to the left of", componentB); 0N/A * If value is <code>null</code> this method will remove the property. 0N/A * Changes to client properties are reported with 0N/A * <code>PropertyChange</code> events. 0N/A * The name of the property (for the sake of PropertyChange 0N/A * events) is <code>key.toString()</code>. 0N/A * The <code>clientProperty</code> dictionary is not intended to 0N/A * scale extensions to JComponent nor should be it considered an 0N/A * alternative to subclassing when designing a new component. 0N/A * @param key the new client property key 0N/A * @param value the new client property value; if <code>null</code> 0N/A * this method will remove the property 0N/A * @see #getClientProperty 0N/A * @see #addPropertyChangeListener 0N/A // Both the value and ArrayTable are null, implying we don't 0N/A // have to do anything. 0N/A // old == new == null 0N/A // Invoked from putClientProperty. This is provided for subclasses 0N/A * Sets the property with the specified name to the specified value if 0N/A * the property has not already been set by the client program. 0N/A * This method is used primarily to set UI defaults for properties 0N/A * with primitive types, where the values cannot be marked with 0N/A * @see LookAndFeel#installProperty 0N/A * @param propertyName String containing the name of the property 0N/A * @param value Object containing the property value 0N/A * Sets the focus traversal keys for a given traversal operation for this 0N/A * {@link java.awt.Component#setFocusTraversalKeys} 0N/A * for a complete description of this method. 0N/A * @param id one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, 0N/A * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or 0N/A * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS 0N/A * @param keystrokes the Set of AWTKeyStroke for the specified operation 0N/A * @see java.awt.KeyboardFocusManager#FORWARD_TRAVERSAL_KEYS 0N/A * @see java.awt.KeyboardFocusManager#BACKWARD_TRAVERSAL_KEYS 0N/A * @see java.awt.KeyboardFocusManager#UP_CYCLE_TRAVERSAL_KEYS 0N/A * @throws IllegalArgumentException if id is not one of 0N/A * KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, 0N/A * KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or 0N/A * KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or if keystrokes 0N/A * contains null, or if any Object in keystrokes is not an 0N/A * AWTKeyStroke, or if any keystroke represents a KEY_TYPED event, 0N/A * or if any keystroke already maps to another focus traversal 0N/A * operation for this Component 0N/A /* --- Transitional java.awt.Component Support --- 0N/A * The methods and fields in this section will migrate to 0N/A * java.awt.Component in the next JDK release. 0N/A * Returns true if this component is lightweight, that is, if it doesn't 0N/A * have a native window system peer. 0N/A * @return true if this component is lightweight 0N/A * @deprecated As of JDK 5, 0N/A * replaced by <code>Component.setBounds(int, int, int, int)</code>. 0N/A * Moves and resizes this component. 0N/A * @param x the new horizontal location 0N/A * @param y the new vertical location 0N/A * @param w the new width 0N/A * @param h the new height 0N/A * @see java.awt.Component#setBounds 0N/A * Stores the bounds of this component into "return value" 0N/A * <code>rv</code> and returns <code>rv</code>. 0N/A * If <code>rv</code> is <code>null</code> a new <code>Rectangle</code> 0N/A * is allocated. This version of <code>getBounds</code> is useful 0N/A * if the caller wants to avoid allocating a new <code>Rectangle</code> 0N/A * object on the heap. 0N/A * @param rv the return value, modified to the component's bounds 0N/A * @return <code>rv</code>; if <code>rv</code> is <code>null</code> 0N/A * return a newly created <code>Rectangle</code> with this 0N/A * component's bounds 0N/A * <code>rv</code> and returns <code>rv</code>. 0N/A * If <code>rv</code> is <code>null</code> a new <code>Dimension</code> 0N/A * object is allocated. This version of <code>getSize</code> 0N/A * is useful if the caller wants to avoid allocating a new 0N/A * <code>Dimension</code> object on the heap. 0N/A * @param rv the return value, modified to the component's size 0N/A * @return <code>rv</code> 0N/A * Stores the x,y origin of this component into "return value" 0N/A * <code>rv</code> and returns <code>rv</code>. 0N/A * If <code>rv</code> is <code>null</code> a new <code>Point</code> 0N/A * is allocated. This version of <code>getLocation</code> is useful 0N/A * if the caller wants to avoid allocating a new <code>Point</code> 0N/A * object on the heap. 0N/A * @param rv the return value, modified to the component's location 0N/A * @return <code>rv</code> 0N/A * Returns the current x coordinate of the component's origin. 0N/A * This method is preferable to writing 0N/A * <code>component.getBounds().x</code>, or 0N/A * <code>component.getLocation().x</code> because it doesn't cause any 0N/A * @return the current x coordinate of the component's origin 0N/A * Returns the current y coordinate of the component's origin. 0N/A * This method is preferable to writing 0N/A * <code>component.getBounds().y</code>, or 0N/A * <code>component.getLocation().y</code> because it doesn't cause any 0N/A * @return the current y coordinate of the component's origin 0N/A * Returns the current width of this component. 0N/A * This method is preferable to writing 0N/A * <code>component.getBounds().width</code>, or 0N/A * <code>component.getSize().width</code> because it doesn't cause any 0N/A * @return the current width of this component 0N/A * Returns the current height of this component. 0N/A * This method is preferable to writing 0N/A * <code>component.getBounds().height</code>, or 0N/A * <code>component.getSize().height</code> because it doesn't cause any 0N/A * @return the current height of this component 0N/A * Returns true if this component is completely opaque. 0N/A * An opaque component paints every pixel within its 0N/A * rectangular bounds. A non-opaque component paints only a subset of 0N/A * its pixels or none at all, allowing the pixels underneath it to 0N/A * "show through". Therefore, a component that does not fully paint 0N/A * its pixels provides a degree of transparency. 0N/A * Subclasses that guarantee to always completely paint their contents 0N/A * should override this method and return true. 0N/A * @return true if this component is completely opaque 0N/A * If true the component paints every pixel within its bounds. 0N/A * Otherwise, the component may not paint some or all of its 0N/A * pixels, allowing the underlying pixels to show through. 0N/A * The default value of this property is false for <code>JComponent</code>. 0N/A * However, the default value for this property on most standard 0N/A * <code>JComponent</code> subclasses (such as <code>JButton</code> and 0N/A * <code>JTree</code>) is look-and-feel dependent. 0N/A * @param isOpaque true if this component should be opaque 0N/A * description: The component's opacity 0N/A * If the specified rectangle is completely obscured by any of this 0N/A * component's opaque children then returns true. Only direct children 0N/A * are considered, more distant descendants are ignored. A 0N/A * <code>JComponent</code> is opaque if 0N/A * <code>JComponent.isOpaque()</code> returns true, other lightweight 0N/A * components are always considered transparent, and heavyweight components 0N/A * are always considered opaque. 0N/A * @param x x value of specified rectangle 0N/A * @param y y value of specified rectangle 0N/A * @param width width of specified rectangle 0N/A * @param height height of specified rectangle 0N/A * @return true if the specified rectangle is obscured by an opaque child 0N/A// System.out.println("A) checking opaque: " + ((JComponent)child).isOpaque() + " " + child); 0N/A// System.out.print("B) "); 0N/A// Thread.dumpStack(); 0N/A /** Sometimes a heavy weight can have a bound larger than its peer size 0N/A * so we should always draw under heavy weights 0N/A * Returns the <code>Component</code>'s "visible rect rectangle" - the 0N/A * intersection of the visible rectangles for the component <code>c</code> 0N/A * and all of its ancestors. The return value is stored in 0N/A * <code>visibleRect</code>. 0N/A * @param c the component 0N/A * @param visibleRect a <code>Rectangle</code> computed as the 0N/A * intersection of all visible rectangles for the component 0N/A * <code>c</code> and all of its ancestors -- this is the 0N/A * return value for this method 0N/A * @see #getVisibleRect 0N/A * Returns the <code>Component</code>'s "visible rect rectangle" - the 0N/A * intersection of the visible rectangles for this component 0N/A * and all of its ancestors. The return value is stored in 0N/A * <code>visibleRect</code>. 0N/A * @param visibleRect a <code>Rectangle</code> computed as the 0N/A * intersection of all visible rectangles for this 0N/A * component and all of its ancestors -- this is the return 0N/A * value for this method 0N/A * @see #getVisibleRect 0N/A * Returns the <code>Component</code>'s "visible rectangle" - the 0N/A * intersection of this component's visible rectangle, 0N/A * <code>new Rectangle(0, 0, getWidth(), getHeight())</code>, 0N/A * and all of its ancestors' visible rectangles. 0N/A * @return the visible rectangle 0N/A * Support for reporting bound property changes for boolean properties. 0N/A * This method can be called when a bound property has changed and it will 0N/A * send the appropriate PropertyChangeEvent to any registered 0N/A * PropertyChangeListeners. 0N/A * @param propertyName the property whose value has changed 0N/A * @param oldValue the property's previous value 0N/A * @param newValue the property's new value 0N/A * Support for reporting bound property changes for integer properties. 0N/A * This method can be called when a bound property has changed and it will 0N/A * send the appropriate PropertyChangeEvent to any registered 0N/A * PropertyChangeListeners. 0N/A * @param propertyName the property whose value has changed 0N/A * @param oldValue the property's previous value 0N/A * @param newValue the property's new value 0N/A // XXX This method is implemented as a workaround to a JLS issue with ambiguous 0N/A // methods. This should be removed once 4758654 is resolved. 0N/A * Supports reporting constrained property changes. 0N/A * This method can be called when a constrained property has changed 0N/A * and it will send the appropriate <code>PropertyChangeEvent</code> 0N/A * to any registered <code>VetoableChangeListeners</code>. 0N/A * @param propertyName the name of the property that was listened on 0N/A * @param oldValue the old value of the property 0N/A * @param newValue the new value of the property 0N/A * @exception PropertyVetoException when the attempt to set the 0N/A * property is vetoed by the component 0N/A * Adds a <code>VetoableChangeListener</code> to the listener list. 0N/A * The listener is registered for all properties. 0N/A * @param listener the <code>VetoableChangeListener</code> to be added 0N/A * Removes a <code>VetoableChangeListener</code> from the listener list. 0N/A * This removes a <code>VetoableChangeListener</code> that was registered 0N/A * for all properties. 0N/A * @param listener the <code>VetoableChangeListener</code> to be removed 0N/A * Returns an array of all the vetoable change listeners 0N/A * registered on this component. 0N/A * @return all of the component's <code>VetoableChangeListener</code>s 0N/A * array if no vetoable change listeners are currently registered 0N/A * @see #addVetoableChangeListener 0N/A * @see #removeVetoableChangeListener 0N/A * Returns the top-level ancestor of this component (either the 0N/A * containing <code>Window</code> or <code>Applet</code>), 0N/A * or <code>null</code> if this component has not 0N/A * been added to any container. 0N/A * @return the top-level <code>Container</code> that this component is in, 0N/A * or <code>null</code> if not in any container 0N/A * Registers <code>listener</code> so that it will receive 0N/A * <code>AncestorEvents</code> when it or any of its ancestors 0N/A * move or are made visible or invisible. 0N/A * Events are also sent when the component or its ancestors are added 0N/A * or removed from the containment hierarchy. 0N/A * @param listener the <code>AncestorListener</code> to register 0N/A * @see AncestorEvent 0N/A * Unregisters <code>listener</code> so that it will no longer receive 0N/A * <code>AncestorEvents</code>. 0N/A * @param listener the <code>AncestorListener</code> to be removed 0N/A * @see #addAncestorListener 0N/A * Returns an array of all the ancestor listeners 0N/A * registered on this component. 0N/A * @return all of the component's <code>AncestorListener</code>s 0N/A * array if no ancestor listeners are currently registered 0N/A * @see #addAncestorListener 0N/A * @see #removeAncestorListener 0N/A * Returns an array of all the objects currently registered 0N/A * as <code><em>Foo</em>Listener</code>s 0N/A * upon this <code>JComponent</code>. 0N/A * <code><em>Foo</em>Listener</code>s are registered using the 0N/A * <code>add<em>Foo</em>Listener</code> method. 0N/A * You can specify the <code>listenerType</code> argument 0N/A * with a class literal, 0N/A * <code><em>Foo</em>Listener.class</code>. 0N/A * For example, you can query a 0N/A * <code>JComponent</code> <code>c</code> 0N/A * for its mouse listeners with the following code: 0N/A * <pre>MouseListener[] mls = (MouseListener[])(c.getListeners(MouseListener.class));</pre> 0N/A * If no such listeners exist, this method returns an empty array. 0N/A * @param listenerType the type of listeners requested; this parameter 0N/A * should specify an interface that descends from 0N/A * <code>java.util.EventListener</code> 0N/A * @return an array of all objects registered as 0N/A * <code><em>Foo</em>Listener</code>s on this component, 0N/A * or an empty array if no such 0N/A * listeners have been added 0N/A * @exception ClassCastException if <code>listenerType</code> 0N/A * doesn't specify a class or interface that implements 0N/A * <code>java.util.EventListener</code> 0N/A * @see #getVetoableChangeListeners 0N/A * @see #getAncestorListeners 0N/A // AncestorListeners are handled by the AncestorNotifier 0N/A // VetoableChangeListeners are handled by VetoableChangeSupport 0N/A // PropertyChangeListeners are handled by PropertyChangeSupport 0N/A * Notifies this component that it now has a parent component. 0N/A * When this method is invoked, the chain of parent components is 0N/A * set up with <code>KeyboardAction</code> event listeners. 0N/A * @see #registerKeyboardAction 0N/A * Notifies this component that it no longer has a parent component. 0N/A * When this method is invoked, any <code>KeyboardAction</code>s 0N/A * set up in the the chain of parent components are removed. 0N/A * @see #registerKeyboardAction 0N/A // This isn't strictly correct. The event shouldn't be 0N/A // fired until *after* the parent is set to null. But 0N/A // we only get notified before that happens 0N/A * Adds the specified region to the dirty region list if the component 0N/A * is showing. The component will be repainted after all of the 0N/A * currently pending events have been dispatched. 0N/A * @param tm this parameter is not used 0N/A * @param x the x value of the dirty region 0N/A * @param y the y value of the dirty region 0N/A * @param width the width of the dirty region 0N/A * @param height the height of the dirty region 0N/A * @see java.awt.Component#isShowing 0N/A * @see RepaintManager#addDirtyRegion 0N/A * Adds the specified region to the dirty region list if the component 0N/A * is showing. The component will be repainted after all of the 0N/A * currently pending events have been dispatched. 0N/A * @param r a <code>Rectangle</code> containing the dirty region 0N/A * @see java.awt.Component#isShowing 0N/A * @see RepaintManager#addDirtyRegion 0N/A * Supports deferred automatic layout. 0N/A * Calls <code>invalidate</code> and then adds this component's 0N/A * <code>validateRoot</code> to a list of components that need to be 0N/A * validated. Validation will occur after all currently pending 0N/A * events have been dispatched. In other words after this method 0N/A * is called, the first validateRoot (if any) found when walking 0N/A * up the containment hierarchy of this component will be validated. 0N/A * By default, <code>JRootPane</code>, <code>JScrollPane</code>, 0N/A * and <code>JTextField</code> return true 0N/A * from <code>isValidateRoot</code>. 0N/A * This method will automatically be called on this component 0N/A * when a property value changes such that size, location, or 0N/A * internal layout of this component has been affected. This automatic 0N/A * updating differs from the AWT because programs generally no 0N/A * longer need to invoke <code>validate</code> to get the contents of the 0N/A * @see java.awt.Component#invalidate 0N/A * @see java.awt.Container#validate 0N/A * @see #isValidateRoot 0N/A * @see RepaintManager#addInvalidComponent 0N/A // Note: We don't bother invalidating here as once added 0N/A // to a valid parent invalidate will be invoked (addImpl 0N/A // invokes addNotify which will invoke invalidate on the 0N/A // new Component). Also, if we do add a check to isValid 0N/A // here it can potentially be called before the constructor 0N/A // which was causing some people grief. 0N/A // To avoid a flood of Runnables when constructing GUIs off 0N/A // the EDT, a flag is maintained as to whether or not 0N/A // a Runnable has been scheduled. 0N/A synchronized(
this) {
0N/A * If this method returns true, <code>revalidate</code> calls by 0N/A * descendants of this component will cause the entire tree 0N/A * beginning with this root to be validated. 0N/A * Returns false by default. <code>JScrollPane</code> overrides 0N/A * this method and returns true. 0N/A * @return always returns false 0N/A * @see java.awt.Component#invalidate 0N/A * @see java.awt.Container#validate 0N/A * Returns true if this component tiles its children -- that is, if 0N/A * it can guarantee that the children will not overlap. The 0N/A * repainting system is substantially more efficient in this 0N/A * common case. <code>JComponent</code> subclasses that can't make this 0N/A * guarantee, such as <code>JLayeredPane</code>, 0N/A * should override this method to return false. 0N/A * @return always returns true 0N/A * Returns true if a paint triggered on a child component should cause 0N/A * painting to originate from this Component, or one of its ancestors. 0N/A * @return true if painting should originate from this Component or 0N/A * one of its ancestors. 0N/A * Paints the specified region in this component and all of its 0N/A * descendants that overlap the region, immediately. 0N/A * It's rarely necessary to call this method. In most cases it's 0N/A * more efficient to call repaint, which defers the actual painting 0N/A * and can collapse redundant requests into a single paint call. 0N/A * This method is useful if one needs to update the display while 0N/A * the current event is being dispatched. 0N/A * @param x the x value of the region to be painted 0N/A * @param y the y value of the region to be painted 0N/A * @param w the width of the region to be painted 0N/A * @param h the height of the region to be painted 0N/A * Paints the specified region now. 0N/A * @param r a <code>Rectangle</code> containing the region to be painted 0N/A * Returns whether this component should be guaranteed to be on top. 0N/A * For example, it would make no sense for <code>Menu</code>s to pop up 0N/A * under another component, so they would always return true. 0N/A * Most components will want to return false, hence that is the default. 0N/A * @return always returns false 0N/A // parent Container's up to Window or Applet. First container is 0N/A // the direct parent. Note that in testing it was faster to 0N/A // alloc a new Vector vs keeping a stack of them around, and gc 0N/A // seemed to have a minimal effect on this. 0N/A // System.out.println("1) ************* in _paintImmediately for " + this); 0N/A // Children of c may overlap, three possible cases for the 0N/A // . Completely obscured by an opaque sibling, in which 0N/A // case there is no need to paint. 0N/A // . Partially obscured by a sibling: need to start 0N/A // . Otherwise we aren't obscured and thus don't need to 0N/A // start painting from parent. 0N/A // Get rid of any buffer since we draw from here and 0N/A // we might draw something larger 0N/A // look to see if the parent (and therefor this component) 0N/A // is double buffered 0N/A // if we aren't on top, include the parent's clip 0N/A // If the clip width or height is negative, don't bother painting 0N/A // Notify the Components that are going to be painted of the 0N/A // child component to paint to. 0N/A for(; i >
0 ; i--) {
0N/A // Reset the painting child for the parent components. 0N/A for(; i >
0 ; i--) {
0N/A * Paints to the specified graphics. This does not set the clip and it 0N/A * does not adjust the Graphics in anyway, callers must do that first. 0N/A * This method is package-private for RepaintManager.PaintManager and 0N/A * its subclasses to call, it is NOT intended for general use outside 0N/A // Called from paintImmediately (RepaintManager) to fill 0N/A // Called from paint() (AWT) to repair damage 0N/A * Returns whether or not the region of the specified component is 0N/A * obscured by a sibling. 0N/A * @return NOT_OBSCURED if non of the siblings above the Component obscure 0N/A * it, COMPLETELY_OBSCURED if one of the siblings completely 0N/A * obscures the Component or PARTIALLY_OBSCURED if the Comonent is 0N/A * only partially obscured. 0N/A * Returns true, which implies that before checking if a child should 0N/A * be painted it is first check that the child is not obscured by another 0N/A * sibling. This is only checked if <code>isOptimizedDrawingEnabled</code> 0N/A * @return always returns true 0N/A // These functions must be static so that they can be called from 0N/A // subclasses inside the package, but whose inheritance hierarhcy includes 0N/A // classes outside of the package below JComponent (e.g., JTextArea). 0N/A * Sets whether this component should use a buffer to paint. 0N/A * If set to true, all the drawing from this component will be done 0N/A * in an offscreen painting buffer. The offscreen painting buffer will 0N/A * the be copied onto the screen. 0N/A * If a <code>Component</code> is buffered and one of its ancestor 0N/A * is also buffered, the ancestor buffer will be used. 0N/A * @param aFlag if true, set this component to be double buffered 0N/A * Returns whether this component should use a buffer to paint. 0N/A * @return true if this component is double buffered, otherwise false 0N/A * Returns the <code>JRootPane</code> ancestor for this component. 0N/A * @return the <code>JRootPane</code> that contains this component, 0N/A * or <code>null</code> if no <code>JRootPane</code> is found 0N/A /** Serialization **/ 0N/A * This is called from Component by way of reflection. Do NOT change 0N/A * the name unless you change the code in Component as well. 0N/A /* JTableHeader is in a separate package, which prevents it from 0N/A * being able to override this package-private method the way the 0N/A * other components can. We don't want to make this method protected 0N/A * because it would introduce public-api for a less-than-desirable 0N/A * serialization scheme, so we compromise with this 'instanceof' hack 0N/A * This object is the <code>ObjectInputStream</code> callback 0N/A * that's called after a complete graph of objects (including at least 0N/A * one <code>JComponent</code>) has been read. 0N/A * It sets the UI property of each Swing component 0N/A * that was read to the current default with <code>updateUI</code>. 0N/A * As each component is read in we keep track of the current set of 0N/A * root components here, in the roots vector. Note that there's only one 0N/A * <code>ReadObjectCallback</code> per <code>ObjectInputStream</code>, 0N/A * they're stored in the static <code>readObjectCallbacks</code> 0N/A * @see java.io.ObjectInputStream#registerValidation 0N/A * @see SwingUtilities#updateComponentTreeUI 0N/A * This is the method that's called after the entire graph 0N/A * of objects has been read in. It initializes 0N/A * the UI property of all of the copmonents with 0N/A * <code>SwingUtilities.updateComponentTreeUI</code>. 0N/A * If <code>c</code> isn't a descendant of a component we've already 0N/A * seen, then add it to the roots <code>Vector</code>. 0N/A * @param c the <code>JComponent</code> to add 0N/A /* If the Component c is a descendant of one of the 0N/A * existing roots (or it IS an existing root), we're done. 0N/A /* Otherwise: if Component c is an ancestor of any of the 0N/A * existing roots then remove them and add c (the "new root") 0N/A * to the roots vector. 0N/A * We use the <code>ObjectInputStream</code> "registerValidation" 0N/A * callback to update the UI for the entire tree of components 0N/A * after they've all been read in. 0N/A * @param s the <code>ObjectInputStream</code> from which to read 0N/A /* If there's no ReadObjectCallback for this stream yet, that is, if 0N/A * this is the first call to JComponent.readObject() for this 0N/A * graph of objects, then create a callback and stash it 0N/A * in the readObjectCallbacks table. Note that the ReadObjectCallback 0N/A * constructor takes care of calling s.registerValidation(). 0N/A // Read back the client properties. 0N/A * Before writing a <code>JComponent</code> to an 0N/A * <code>ObjectOutputStream</code> we temporarily uninstall its UI. 0N/A * This is tricky to do because we want to uninstall 0N/A * the UI before any of the <code>JComponent</code>'s children 0N/A * (or its <code>LayoutManager</code> etc.) are written, 0N/A * and we don't want to restore the UI until the most derived 0N/A * <code>JComponent</code> subclass has been been stored. 0N/A * @param s the <code>ObjectOutputStream</code> in which to write 0N/A * Returns a string representation of this <code>JComponent</code>. 0N/A * is intended to be used only for debugging purposes, and the 0N/A * content and format of the returned string may vary between 0N/A * implementations. The returned string may be empty but may not 0N/A * be <code>null</code>. 0N/A * @return a string representation of this <code>JComponent</code> 0N/A ",flags=" +
flags +
// should beef this up a bit