Java Doc for ComponentUI.java in  » 6.0-JDK-Core » swing » javax » swing » plaf » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » swing » javax.swing.plaf 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.swing.plaf.ComponentUI

All known Subclasses:   javax.swing.plaf.SliderUI,  javax.swing.plaf.TabbedPaneUI,  javax.swing.plaf.MenuBarUI,  javax.swing.plaf.ListUI,  javax.swing.plaf.LabelUI,  javax.swing.plaf.PanelUI,  javax.swing.plaf.TableUI,  javax.swing.plaf.ComboBoxUI,  javax.swing.plaf.DesktopPaneUI,  javax.swing.plaf.ProgressBarUI,  javax.swing.plaf.SpinnerUI,  javax.swing.plaf.ScrollPaneUI,  javax.swing.plaf.ToolBarUI,  javax.swing.plaf.RootPaneUI,  javax.swing.plaf.TreeUI,  javax.swing.plaf.TableHeaderUI,  javax.swing.plaf.InternalFrameUI,  javax.swing.plaf.OptionPaneUI,  javax.swing.plaf.ButtonUI,  javax.swing.plaf.TextUI,  javax.swing.plaf.ToolTipUI,  javax.swing.plaf.DesktopIconUI,  javax.swing.plaf.PopupMenuUI,  javax.swing.plaf.ColorChooserUI,  javax.swing.plaf.ViewportUI,  javax.swing.plaf.SplitPaneUI,  javax.swing.plaf.SeparatorUI,  javax.swing.plaf.FileChooserUI,  javax.swing.plaf.ScrollBarUI,
ComponentUI
abstract public class ComponentUI (Code)
The base class for all UI delegate objects in the Swing pluggable look and feel architecture. The UI delegate object for a Swing component is responsible for implementing the aspects of the component that depend on the look and feel. The JComponent class invokes methods from this class in order to delegate operations (painting, layout calculations, etc.) that may vary depending on the look and feel installed. Client programs should not invoke methods on this class directly.
See Also:   javax.swing.JComponent
See Also:   javax.swing.UIManager
See Also:   



Constructor Summary
public  ComponentUI()
     Sole constructor.

Method Summary
public  booleancontains(JComponent c, int x, int y)
     Returns true if the specified x,y location is contained within the look and feel's defined shape of the specified component.
public static  ComponentUIcreateUI(JComponent c)
     Returns an instance of the UI delegate for the specified component. Each subclass must provide its own static createUI method that returns an instance of that UI delegate subclass. If the UI delegate subclass is stateless, it may return an instance that is shared by multiple components.
public  AccessiblegetAccessibleChild(JComponent c, int i)
     Returns the ith Accessible child of the object.
public  intgetAccessibleChildrenCount(JComponent c)
     Returns the number of accessible children in the object.
public  intgetBaseline(JComponent c, int width, int height)
     Returns the baseline.
public  Component.BaselineResizeBehaviorgetBaselineResizeBehavior(JComponent c)
     Returns an enum indicating how the baseline of he component changes as the size changes.
public  DimensiongetMaximumSize(JComponent c)
     Returns the specified component's maximum size appropriate for the look and feel.
public  DimensiongetMinimumSize(JComponent c)
     Returns the specified component's minimum size appropriate for the look and feel.
public  DimensiongetPreferredSize(JComponent c)
     Returns the specified component's preferred size appropriate for the look and feel.
public  voidinstallUI(JComponent c)
     Configures the specified component appropriate for the look and feel. This method is invoked when the ComponentUI instance is being installed as the UI delegate on the specified component.
public  voidpaint(Graphics g, JComponent c)
     Paints the specified component appropriate for the look and feel. This method is invoked from the ComponentUI.update method when the specified component is being painted.
public  voiduninstallUI(JComponent c)
     Reverses configuration which was done on the specified component during installUI.
public  voidupdate(Graphics g, JComponent c)
     Notifies this UI delegate that it's time to paint the specified component.


Constructor Detail
ComponentUI
public ComponentUI()(Code)
Sole constructor. (For invocation by subclass constructors, typically implicit.)




Method Detail
contains
public boolean contains(JComponent c, int x, int y)(Code)
Returns true if the specified x,y location is contained within the look and feel's defined shape of the specified component. x and y are defined to be relative to the coordinate system of the specified component. Although a component's bounds is constrained to a rectangle, this method provides the means for defining a non-rectangular shape within those bounds for the purpose of hit detection.
Parameters:
  c - the component where the x,y location is being queried;this argument is often ignored,but might be used if the UI object is statelessand shared by multiple components
Parameters:
  x - the x coordinate of the point
Parameters:
  y - the y coordinate of the point
See Also:   javax.swing.JComponent.contains
See Also:   java.awt.Component.contains



createUI
public static ComponentUI createUI(JComponent c)(Code)
Returns an instance of the UI delegate for the specified component. Each subclass must provide its own static createUI method that returns an instance of that UI delegate subclass. If the UI delegate subclass is stateless, it may return an instance that is shared by multiple components. If the UI delegate is stateful, then it should return a new instance per component. The default implementation of this method throws an error, as it should never be invoked.



getAccessibleChild
public Accessible getAccessibleChild(JComponent c, int i)(Code)
Returns the ith Accessible child of the object. UIs might need to override this if they present areas on the screen that can be viewed as components, but actual components are not used for presenting those areas.

Note: As of v1.3, it is recommended that developers call Component.AccessibleAWTComponent.getAccessibleChild() instead of this method.
See Also:   ComponentUI.getAccessibleChildrenCount
Parameters:
  i - zero-based index of child the ith Accessible child of the object




getAccessibleChildrenCount
public int getAccessibleChildrenCount(JComponent c)(Code)
Returns the number of accessible children in the object. If all of the children of this object implement Accessible, this method should return the number of children of this object. UIs might wish to override this if they present areas on the screen that can be viewed as components, but actual components are not used for presenting those areas. Note: As of v1.3, it is recommended that developers call Component.AccessibleAWTComponent.getAccessibleChildrenCount() instead of this method.
See Also:   ComponentUI.getAccessibleChild the number of accessible children in the object



getBaseline
public int getBaseline(JComponent c, int width, int height)(Code)
Returns the baseline. The baseline is measured from the top of the component. This method is primarily meant for LayoutManagers to align components along their baseline. A return value less than 0 indicates this component does not have a reasonable baseline and that LayoutManagers should not align this component on its baseline.

This method returns -1. Subclasses that have a meaningful baseline should override appropriately.
Parameters:
  c - JComponent baseline is being requested for
Parameters:
  width - the width to get the baseline for
Parameters:
  height - the height to get the baseline for
throws:
  NullPointerException - if c is null
throws:
  IllegalArgumentException - if width or height is < 0 baseline or a value < 0 indicating there is no reasonablebaseline
See Also:   javax.swing.JComponent.getBaseline(intint)
since:
   1.6




getBaselineResizeBehavior
public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)(Code)
Returns an enum indicating how the baseline of he component changes as the size changes. This method is primarily meant for layout managers and GUI builders.

This method returns BaselineResizeBehavior.OTHER. Subclasses that support a baseline should override appropriately.
Parameters:
  c - JComponent to return baseline resize behavior for an enum indicating how the baseline changes as the componentsize changes
throws:
  NullPointerException - if c is null
See Also:   javax.swing.JComponent.getBaseline(intint)
since:
   1.6




getMaximumSize
public Dimension getMaximumSize(JComponent c)(Code)
Returns the specified component's maximum size appropriate for the look and feel. If null is returned, the maximum size will be calculated by the component's layout manager instead (this is the preferred approach for any component with a specific layout manager installed). The default implementation of this method invokes getPreferredSize and returns that value.
Parameters:
  c - the component whose maximum size is being queried;this argument is often ignored,but might be used if the UI object is statelessand shared by multiple components a Dimension object or null
See Also:   javax.swing.JComponent.getMaximumSize
See Also:   java.awt.LayoutManager2.maximumLayoutSize



getMinimumSize
public Dimension getMinimumSize(JComponent c)(Code)
Returns the specified component's minimum size appropriate for the look and feel. If null is returned, the minimum size will be calculated by the component's layout manager instead (this is the preferred approach for any component with a specific layout manager installed). The default implementation of this method invokes getPreferredSize and returns that value.
Parameters:
  c - the component whose minimum size is being queried;this argument is often ignored,but might be used if the UI object is statelessand shared by multiple components a Dimension object or null
See Also:   javax.swing.JComponent.getMinimumSize
See Also:   java.awt.LayoutManager.minimumLayoutSize
See Also:   ComponentUI.getPreferredSize



getPreferredSize
public Dimension getPreferredSize(JComponent c)(Code)
Returns the specified component's preferred size appropriate for the look and feel. If null is returned, the preferred size will be calculated by the component's layout manager instead (this is the preferred approach for any component with a specific layout manager installed). The default implementation of this method returns null.
Parameters:
  c - the component whose preferred size is being queried;this argument is often ignored,but might be used if the UI object is statelessand shared by multiple components
See Also:   javax.swing.JComponent.getPreferredSize
See Also:   java.awt.LayoutManager.preferredLayoutSize



installUI
public void installUI(JComponent c)(Code)
Configures the specified component appropriate for the look and feel. This method is invoked when the ComponentUI instance is being installed as the UI delegate on the specified component. This method should completely configure the component for the look and feel, including the following:
  1. Install any default property values for color, fonts, borders, icons, opacity, etc. on the component. Whenever possible, property values initialized by the client program should not be overridden.
  2. Install a LayoutManager on the component if necessary.
  3. Create/add any required sub-components to the component.
  4. Create/install event listeners on the component.
  5. Create/install a PropertyChangeListener on the component in order to detect and respond to component property changes appropriately.
  6. Install keyboard UI (mnemonics, traversal, etc.) on the component.
  7. Initialize any appropriate instance data.

Parameters:
  c - the component where this UI delegate is being installed
See Also:   ComponentUI.uninstallUI
See Also:   javax.swing.JComponent.setUI
See Also:   javax.swing.JComponent.updateUI



paint
public void paint(Graphics g, JComponent c)(Code)
Paints the specified component appropriate for the look and feel. This method is invoked from the ComponentUI.update method when the specified component is being painted. Subclasses should override this method and use the specified Graphics object to render the content of the component.
Parameters:
  g - the Graphics context in which to paint
Parameters:
  c - the component being painted;this argument is often ignored,but might be used if the UI object is statelessand shared by multiple components
See Also:   ComponentUI.update



uninstallUI
public void uninstallUI(JComponent c)(Code)
Reverses configuration which was done on the specified component during installUI. This method is invoked when this UIComponent instance is being removed as the UI delegate for the specified component. This method should undo the configuration performed in installUI, being careful to leave the JComponent instance in a clean state (no extraneous listeners, look-and-feel-specific property objects, etc.). This should include the following:
  1. Remove any UI-set borders from the component.
  2. Remove any UI-set layout managers on the component.
  3. Remove any UI-added sub-components from the component.
  4. Remove any UI-added event/property listeners from the component.
  5. Remove any UI-installed keyboard UI from the component.
  6. Nullify any allocated instance data objects to allow for GC.

Parameters:
  c - the component from which this UI delegate is being removed;this argument is often ignored,but might be used if the UI object is statelessand shared by multiple components
See Also:   ComponentUI.installUI
See Also:   javax.swing.JComponent.updateUI



update
public void update(Graphics g, JComponent c)(Code)
Notifies this UI delegate that it's time to paint the specified component. This method is invoked by JComponent when the specified component is being painted. By default this method will fill the specified component with its background color (if its opaque property is true) and then immediately call paint. In general this method need not be overridden by subclasses; all look-and-feel rendering code should reside in the paint method.
Parameters:
  g - the Graphics context in which to paint
Parameters:
  c - the component being painted;this argument is often ignored,but might be used if the UI object is statelessand shared by multiple components
See Also:   ComponentUI.paint
See Also:   javax.swing.JComponent.paintComponent



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.