java.lang.Objectjavax.swing.plaf.ComponentUI
javax.swing.plaf.OptionPaneUI
javax.swing.plaf.basic.BasicOptionPaneUI
public class BasicOptionPaneUI
Provides the basic look and feel for a JOptionPane.
BasicMessagePaneUI provides a means to place an icon,
message and buttons into a Container.
Generally, the layout will look like:
------------------ | i | message | | c | message | | o | message | | n | message | ------------------ | buttons | |________________|
Icon that is wrapped inside a
JLabel. The message is an opaque object and is tested
for the following: if the message is a Component it is
added to the Container, if it is an Icon
it is wrapped inside a JLabel and added to the
Container otherwise it is wrapped inside a JLabel.
The above layout is used when the option pane's
ComponentOrientation property is horizontal, left-to-right.
The layout will be adjusted appropriately for other orientations.
The Container, message, icon, and buttons are all
determined from abstract methods.
| Nested Class Summary | |
|---|---|
class |
BasicOptionPaneUI.ButtonActionListener
This inner class is marked "public" due to a compiler bug. |
static class |
BasicOptionPaneUI.ButtonAreaLayout
ButtonAreaLayout behaves in a similar manner to
FlowLayout. |
class |
BasicOptionPaneUI.PropertyChangeHandler
This inner class is marked "public" due to a compiler bug. |
| Field Summary | |
|---|---|
protected boolean |
hasCustomComponents
This is set to true in validateComponent if a Component is contained in either the message or the buttons. |
protected Component |
initialFocusComponent
Component to receive focus when messaged with selectInitialValue. |
protected JComponent |
inputComponent
JComponent provide for input if optionPane.getWantsInput() returns true. |
static int |
MinimumHeight
|
protected Dimension |
minimumSize
|
static int |
MinimumWidth
|
protected JOptionPane |
optionPane
JOptionPane that the receiver is providing the
look and feel for. |
protected PropertyChangeListener |
propertyChangeListener
|
| Constructor Summary | |
|---|---|
BasicOptionPaneUI()
|
|
| Method Summary | |
|---|---|
protected void |
addButtonComponents(Container container,
Object[] buttons,
int initialIndex)
Creates the appropriate object to represent each of the objects in buttons and adds it to container. |
protected void |
addIcon(Container top)
Creates and adds a JLabel representing the icon returned from getIcon to top. |
protected void |
addMessageComponents(Container container,
GridBagConstraints cons,
Object msg,
int maxll,
boolean internallyCreated)
Creates the appropriate object to represent msg and
places it into container. |
protected void |
burstStringInto(Container c,
String d,
int maxll)
Recursively creates new JLabel instances to represent d. |
boolean |
containsCustomComponents(JOptionPane op)
Returns true if in the last call to validateComponent the message or buttons contained a subclass of Component. |
protected ActionListener |
createButtonActionListener(int buttonIndex)
|
protected Container |
createButtonArea()
Creates and returns a Container containing the buttons. |
protected LayoutManager |
createLayoutManager()
|
protected Container |
createMessageArea()
Messaged from installComponents to create a Container containing the body of the message. |
protected PropertyChangeListener |
createPropertyChangeListener()
|
protected Container |
createSeparator()
|
static ComponentUI |
createUI(JComponent x)
Creates a new BasicOptionPaneUI instance. |
protected Object[] |
getButtons()
Returns the buttons to display from the JOptionPane the receiver is providing the look and feel for. |
protected Icon |
getIcon()
Returns the icon from the JOptionPane the receiver is providing the look and feel for, or the default icon as returned from getDefaultIcon. |
protected Icon |
getIconForType(int messageType)
Returns the icon to use for the passed in type. |
protected int |
getInitialValueIndex()
Returns the initial index into the buttons to select. |
protected int |
getMaxCharactersPerLineCount()
Returns the maximum number of characters to place on a line. |
protected Object |
getMessage()
Returns the message to display from the JOptionPane the receiver is providing the look and feel for. |
Dimension |
getMinimumOptionPaneSize()
Returns the minimum size the option pane should be. |
Dimension |
getPreferredSize(JComponent c)
If c is the JOptionPane the receiver
is contained in, the preferred
size that is returned is the maximum of the preferred size of
the LayoutManager for the JOptionPane, and
getMinimumOptionPaneSize. |
protected boolean |
getSizeButtonsToSameWidth()
Returns true, basic L&F wants all the buttons to have the same width. |
protected void |
installComponents()
|
protected void |
installDefaults()
|
protected void |
installKeyboardActions()
|
protected void |
installListeners()
|
void |
installUI(JComponent c)
Installs the receiver as the L&F for the passed in JOptionPane. |
protected void |
resetInputValue()
Sets the input value in the option pane the receiver is providing the look and feel for based on the value in the inputComponent. |
void |
selectInitialValue(JOptionPane op)
If inputComponent is non-null, the focus is requested on that, otherwise request focus on the default value |
protected void |
uninstallComponents()
|
protected void |
uninstallDefaults()
|
protected void |
uninstallKeyboardActions()
|
protected void |
uninstallListeners()
|
void |
uninstallUI(JComponent c)
Removes the receiver from the L&F controller of the passed in split pane. |
| Methods inherited from class javax.swing.plaf.ComponentUI |
|---|
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, paint, update |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MinimumWidth
public static final int MinimumHeight
protected JOptionPane optionPane
JOptionPane that the receiver is providing the
look and feel for.
protected Dimension minimumSize
protected JComponent inputComponent
protected Component initialFocusComponent
protected boolean hasCustomComponents
protected PropertyChangeListener propertyChangeListener
| Constructor Detail |
|---|
public BasicOptionPaneUI()
| Method Detail |
|---|
public static ComponentUI createUI(JComponent x)
public void installUI(JComponent c)
JOptionPane.
installUI in class ComponentUIc - the component where this UI delegate is being installedComponentUI.uninstallUI(javax.swing.JComponent),
JComponent.setUI(javax.swing.plaf.ComponentUI),
JComponent.updateUI()public void uninstallUI(JComponent c)
uninstallUI in class ComponentUIc - 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 componentsComponentUI.installUI(javax.swing.JComponent),
JComponent.updateUI()protected void installDefaults()
protected void uninstallDefaults()
protected void installComponents()
protected void uninstallComponents()
protected LayoutManager createLayoutManager()
protected void installListeners()
protected void uninstallListeners()
protected PropertyChangeListener createPropertyChangeListener()
protected void installKeyboardActions()
protected void uninstallKeyboardActions()
public Dimension getMinimumOptionPaneSize()
public Dimension getPreferredSize(JComponent c)
c is the JOptionPane the receiver
is contained in, the preferred
size that is returned is the maximum of the preferred size of
the LayoutManager for the JOptionPane, and
getMinimumOptionPaneSize.
getPreferredSize in class ComponentUIc - 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)protected Container createMessageArea()
addIcon.
protected void addMessageComponents(Container container, GridBagConstraints cons, Object msg, int maxll, boolean internallyCreated)
msg and
places it into container. If msg is an
instance of Component, it is added directly, if it is an Icon,
a JLabel is created to represent it, otherwise a JLabel is
created for the string, if d is an Object[], this
method will be recursively invoked for the children.
internallyCreated is true if Objc is an instance
of Component and was created internally by this method (this is
used to correctly set hasCustomComponents only if !internallyCreated).
protected Object getMessage()
protected void addIcon(Container top)
getIcon to top. This is messaged from
createMessageArea
protected Icon getIcon()
getDefaultIcon.
protected Icon getIconForType(int messageType)
protected int getMaxCharactersPerLineCount()
protected void burstStringInto(Container c, String d, int maxll)
d.
Each JLabel instance is added to c.
protected Container createSeparator()
protected Container createButtonArea()
getButtons.
protected void addButtonComponents(Container container, Object[] buttons, int initialIndex)
buttons and adds it to container. This
differs from addMessageComponents in that it will recurse on
buttons and that if button is not a Component
it will create an instance of JButton.
protected ActionListener createButtonActionListener(int buttonIndex)
protected Object[] getButtons()
protected boolean getSizeButtonsToSameWidth()
protected int getInitialValueIndex()
protected void resetInputValue()
public void selectInitialValue(JOptionPane op)
selectInitialValue in class OptionPaneUIpublic boolean containsCustomComponents(JOptionPane op)
containsCustomComponents in class OptionPaneUICes 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.
8 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)