javax.swing.plaf.basic

Class BasicOptionPaneUI

  • Direct Known Subclasses:
    SynthOptionPaneUI

    public class BasicOptionPaneUI
    extends OptionPaneUI
    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 is an instance of 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.

    • Field Detail

      • optionPane

        protected JOptionPane optionPane
        JOptionPane that the receiver is providing the look and feel for.
      • minimumSize

        protected Dimension minimumSize
      • inputComponent

        protected JComponent inputComponent
        JComponent provide for input if optionPane.getWantsInput() returns true.
      • initialFocusComponent

        protected Component initialFocusComponent
        Component to receive focus when messaged with selectInitialValue.
      • hasCustomComponents

        protected boolean hasCustomComponents
        This is set to true in validateComponent if a Component is contained in either the message or the buttons.
    • Constructor Detail

      • BasicOptionPaneUI

        public BasicOptionPaneUI()
    • Method Detail

      • installDefaults

        protected void installDefaults()
      • uninstallDefaults

        protected void uninstallDefaults()
      • installComponents

        protected void installComponents()
      • uninstallComponents

        protected void uninstallComponents()
      • createLayoutManager

        protected LayoutManager createLayoutManager()
      • installListeners

        protected void installListeners()
      • uninstallListeners

        protected void uninstallListeners()
      • installKeyboardActions

        protected void installKeyboardActions()
      • uninstallKeyboardActions

        protected void uninstallKeyboardActions()
      • getMinimumOptionPaneSize

        public Dimension getMinimumOptionPaneSize()
        Returns the minimum size the option pane should be. Primarily provided for subclassers wishing to offer a different minimum size.
      • createMessageArea

        protected Container createMessageArea()
        Messaged from installComponents to create a Container containing the body of the message. The icon is the created by calling addIcon.
      • addMessageComponents

        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. 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).
      • getMessage

        protected Object getMessage()
        Returns the message to display from the JOptionPane the receiver is providing the look and feel for.
      • addIcon

        protected void addIcon(Container top)
        Creates and adds a JLabel representing the icon returned from getIcon to top. This is messaged from createMessageArea
      • getIcon

        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.
      • getIconForType

        protected Icon getIconForType(int messageType)
        Returns the icon to use for the passed in type.
      • getMaxCharactersPerLineCount

        protected int getMaxCharactersPerLineCount()
        Returns the maximum number of characters to place on a line.
      • burstStringInto

        protected void burstStringInto(Container c,
                           String d,
                           int maxll)
        Recursively creates new JLabel instances to represent d. Each JLabel instance is added to c.
      • createSeparator

        protected Container createSeparator()
      • createButtonArea

        protected Container createButtonArea()
        Creates and returns a Container containing the buttons. The buttons are created by calling getButtons.
      • addButtonComponents

        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. 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.
      • createButtonActionListener

        protected ActionListener createButtonActionListener(int buttonIndex)
      • getButtons

        protected Object[] getButtons()
        Returns the buttons to display from the JOptionPane the receiver is providing the look and feel for. If the JOptionPane has options set, they will be provided, otherwise if the optionType is YES_NO_OPTION, yesNoOptions is returned, if the type is YES_NO_CANCEL_OPTION yesNoCancelOptions is returned, otherwise defaultButtons are returned.
      • getSizeButtonsToSameWidth

        protected boolean getSizeButtonsToSameWidth()
        Returns true, basic L&F wants all the buttons to have the same width.
      • getInitialValueIndex

        protected int getInitialValueIndex()
        Returns the initial index into the buttons to select. The index is calculated from the initial value from the JOptionPane and options of the JOptionPane or 0.
      • resetInputValue

        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.
      • selectInitialValue

        public void selectInitialValue(JOptionPane op)
        If inputComponent is non-null, the focus is requested on that, otherwise request focus on the default value
        Specified by:
        selectInitialValue in class OptionPaneUI
      • containsCustomComponents

        public boolean containsCustomComponents(JOptionPane op)
        Returns true if in the last call to validateComponent the message or buttons contained a subclass of Component.
        Specified by:
        containsCustomComponents in class OptionPaneUI

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/swing/plaf/basic/basicoptionpaneui.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : https://docs.oracle.com

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut