Geen cache-versie.

Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code LNG204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.
javax.swing

Class JCheckBoxMenuItem

  • All Implemented Interfaces:
    ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, MenuElement, SwingConstants

    public class JCheckBoxMenuItem
    extends JMenuItem
    implements SwingConstants, Accessible
    A menu item that can be selected or deselected. If selected, the menu item typically appears with a checkmark next to it. If unselected or deselected, the menu item appears without a checkmark. Like a regular menu item, a check box menu item can have either text or a graphic icon associated with it, or both.

    Either isSelected/setSelected or getState/setState can be used to determine/specify the menu item's selection state. The preferred methods are isSelected and setSelected, which work for all menus and buttons. The getState and setState methods exist for compatibility with other component sets.

    Menu items can be configured, and to some degree controlled, by Actions. Using an Action with a menu item has many benefits beyond directly configuring a menu item. Refer to Swing Components Supporting Action for more details, and you can find more information in How to Use Actions, a section in The Java Tutorial.

    For further information and examples of using check box menu items, see How to Use Menus, a section in The Java Tutorial.

    Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

    Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see XMLEncoder.

    • Constructor Detail

      • JCheckBoxMenuItem

        public JCheckBoxMenuItem()
        Creates an initially unselected check box menu item with no set text or icon.
      • JCheckBoxMenuItem

        public JCheckBoxMenuItem(Icon icon)
        Creates an initially unselected check box menu item with an icon.
        Parameters:
        icon - the icon of the CheckBoxMenuItem.
      • JCheckBoxMenuItem

        public JCheckBoxMenuItem(String text)
        Creates an initially unselected check box menu item with text.
        Parameters:
        text - the text of the CheckBoxMenuItem
      • JCheckBoxMenuItem

        public JCheckBoxMenuItem(Action a)
        Creates a menu item whose properties are taken from the Action supplied.
        Since:
        1.3
      • JCheckBoxMenuItem

        public JCheckBoxMenuItem(String text,
                         Icon icon)
        Creates an initially unselected check box menu item with the specified text and icon.
        Parameters:
        text - the text of the CheckBoxMenuItem
        icon - the icon of the CheckBoxMenuItem
      • JCheckBoxMenuItem

        public JCheckBoxMenuItem(String text,
                         boolean b)
        Creates a check box menu item with the specified text and selection state.
        Parameters:
        text - the text of the check box menu item.
        b - the selected state of the check box menu item
      • JCheckBoxMenuItem

        public JCheckBoxMenuItem(String text,
                         Icon icon,
                         boolean b)
        Creates a check box menu item with the specified text, icon, and selection state.
        Parameters:
        text - the text of the check box menu item
        icon - the icon of the check box menu item
        b - the selected state of the check box menu item
    • Method Detail

      • getState

        public boolean getState()
        Returns the selected-state of the item. This method exists for AWT compatibility only. New code should use isSelected() instead.
        Returns:
        true if the item is selected
      • setState

        public void setState(boolean b)
        Sets the selected-state of the item. This method exists for AWT compatibility only. New code should use setSelected() instead.
        Parameters:
        b - a boolean value indicating the item's selected-state, where true=selected
      • getSelectedObjects

        public Object[] getSelectedObjects()
        Returns an array (length 1) containing the check box menu item label or null if the check box is not selected.
        Specified by:
        getSelectedObjects in interface ItemSelectable
        Overrides:
        getSelectedObjects in class AbstractButton
        Returns:
        an array containing one Object -- the text of the menu item -- if the item is selected; otherwise null
      • paramString

        protected String paramString()
        Returns a string representation of this JCheckBoxMenuItem. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.
        Overrides:
        paramString in class JMenuItem
        Returns:
        a string representation of this JCheckBoxMenuItem.
      • getAccessibleContext

        public AccessibleContext getAccessibleContext()
        Gets the AccessibleContext associated with this JCheckBoxMenuItem. For JCheckBoxMenuItems, the AccessibleContext takes the form of an AccessibleJCheckBoxMenuItem. A new AccessibleJCheckBoxMenuItem instance is created if necessary.
        Specified by:
        getAccessibleContext in interface Accessible
        Overrides:
        getAccessibleContext in class JMenuItem
        Returns:
        an AccessibleJCheckBoxMenuItem that serves as the AccessibleContext of this AccessibleJCheckBoxMenuItem

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/jcheckboxmenuitem.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