java.lang.Objectjavax.swing.plaf.ComponentUI
public abstract class ComponentUI
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.
JComponent,
UIManager| Constructor Summary | |
|---|---|
ComponentUI()
Sole constructor. |
|
| Method Summary | |
|---|---|
boolean |
contains(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. |
static ComponentUI |
createUI(JComponent c)
Returns an instance of the UI delegate for the specified component. |
Accessible |
getAccessibleChild(JComponent c,
int i)
Returns the ith Accessible child of the object. |
int |
getAccessibleChildrenCount(JComponent c)
Returns the number of accessible children in the object. |
Dimension |
getMaximumSize(JComponent c)
Returns the specified component's maximum size appropriate for the look and feel. |
Dimension |
getMinimumSize(JComponent c)
Returns the specified component's minimum size appropriate for the look and feel. |
Dimension |
getPreferredSize(JComponent c)
Returns the specified component's preferred size appropriate for the look and feel. |
void |
installUI(JComponent c)
Configures the specified component appropriate for the look and feel. |
void |
paint(Graphics g,
JComponent c)
Paints the specified component appropriate for the look and feel. |
void |
uninstallUI(JComponent c)
Reverses configuration which was done on the specified component during installUI. |
void |
update(Graphics g,
JComponent c)
Notifies this UI delegate that it's time to paint the specified component. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ComponentUI()
| Method Detail |
|---|
public void installUI(JComponent c)
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:
LayoutManager on the component if necessary.
PropertyChangeListener on the component in order
to detect and respond to component property changes appropriately.
c - the component where this UI delegate is being installeduninstallUI(javax.swing.JComponent),
JComponent.setUI(javax.swing.plaf.ComponentUI),
JComponent.updateUI()public void uninstallUI(JComponent c)
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:
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 stateless
and shared by multiple componentsinstallUI(javax.swing.JComponent),
JComponent.updateUI()public void paint(Graphics g, JComponent c)
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.
g - the Graphics context in which to paintc - the component being painted;
this argument is often ignored,
but might be used if the UI object is stateless
and shared by multiple componentsupdate(java.awt.Graphics, javax.swing.JComponent)public void update(Graphics g, JComponent c)
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.
g - the Graphics context in which to paintc - the component being painted;
this argument is often ignored,
but might be used if the UI object is stateless
and shared by multiple componentspaint(java.awt.Graphics, javax.swing.JComponent),
JComponent.paintComponent(java.awt.Graphics)public Dimension getPreferredSize(JComponent c)
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.
c - the component whose preferred size is being queried;
this argument is often ignored,
but might be used if the UI object is stateless
and shared by multiple componentsJComponent.getPreferredSize(),
LayoutManager.preferredLayoutSize(java.awt.Container)public Dimension getMinimumSize(JComponent c)
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.
c - the component whose minimum size is being queried;
this argument is often ignored,
but might be used if the UI object is stateless
and shared by multiple components
Dimension object or nullJComponent.getMinimumSize(),
LayoutManager.minimumLayoutSize(java.awt.Container),
getPreferredSize(javax.swing.JComponent)public Dimension getMaximumSize(JComponent c)
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.
c - the component whose maximum size is being queried;
this argument is often ignored,
but might be used if the UI object is stateless
and shared by multiple components
Dimension object or nullJComponent.getMaximumSize(),
LayoutManager2.maximumLayoutSize(java.awt.Container)public boolean contains(JComponent c, int x, int y)
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.
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 stateless
and shared by multiple componentsx - the x coordinate of the pointy - the y coordinate of the pointJComponent.contains(int, int),
Component.contains(int, int)public static ComponentUI createUI(JComponent c)
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.
public int getAccessibleChildrenCount(JComponent c)
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.
getAccessibleChild(javax.swing.JComponent, int)public Accessible getAccessibleChild(JComponent c, int i)
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.
i - zero-based index of child
ith Accessible child of the objectgetAccessibleChildrenCount(javax.swing.JComponent)Ces informations proviennent du site de http://java.sun.com
Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :
Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.
Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.
Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.
Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.
Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.
Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.
7 mots clés dont 0 définis manuellement (plus d'information...).
Avertissement
Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.
Recherche (afficher)
Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
Citation (masquer)