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 SpinnerListModel

  • All Implemented Interfaces:
    Serializable, SpinnerModel

    public class SpinnerListModel
    extends AbstractSpinnerModel
    implements Serializable
    A simple implementation of SpinnerModel whose values are defined by an array or a List. For example to create a model defined by an array of the names of the days of the week:
     String[] days = new DateFormatSymbols().getWeekdays();
     SpinnerModel model = new SpinnerListModel(Arrays.asList(days).subList(1, 8));
     
    This class only stores a reference to the array or List so if an element of the underlying sequence changes, it's up to the application to notify the ChangeListeners by calling fireStateChanged.

    This model inherits a ChangeListener. The ChangeListeners are notified whenever the model's value or list properties changes.

    Since:
    1.4
    See Also:
    JSpinner, SpinnerModel, AbstractSpinnerModel, SpinnerNumberModel, SpinnerDateModel
    • Constructor Detail

      • SpinnerListModel

        public SpinnerListModel(List<?> values)
        Constructs a SpinnerModel whose sequence of values is defined by the specified List. The initial value (current element) of the model will be values.get(0). If values is null or has zero size, an IllegalArugmentException is thrown.
        Parameters:
        values - the sequence this model represents
        Throws:
        IllegalArugmentException - if values is null or zero size
      • SpinnerListModel

        public SpinnerListModel(Object[] values)
        Constructs a SpinnerModel whose sequence of values is defined by the specified array. The initial value of the model will be values[0]. If values is null or has zero length, an IllegalArugmentException is thrown.
        Parameters:
        values - the sequence this model represents
        Throws:
        IllegalArugmentException - if values is null or zero length
      • SpinnerListModel

        public SpinnerListModel()
        Constructs an effectively empty SpinnerListModel. The model's list will contain a single "empty" string element.
    • Method Detail

      • getList

        public List<?> getList()
        Returns the List that defines the sequence for this model.
        Returns:
        the value of the list property
        See Also:
        setList(java.util.List<?>)
      • setList

        public void setList(List<?> list)
        Changes the list that defines this sequence and resets the index of the models value to zero. Note that list is not copied, the model just stores a reference to it.

        This method fires a ChangeEvent if list is not equal to the current list.

        Parameters:
        list - the sequence that this model represents
        Throws:
        IllegalArgumentException - if list is null or zero length
        See Also:
        getList()
      • setValue

        public void setValue(Object elt)
        Changes the current element of the sequence and notifies ChangeListeners. If the specified value is not equal to an element of the underlying sequence then an IllegalArgumentException is thrown. In the following example the setValue call would cause an exception to be thrown:
         String[] values = {"one", "two", "free", "four"};
         SpinnerModel model = new SpinnerListModel(values);
         model.setValue("TWO");
         
        Specified by:
        setValue in interface SpinnerModel
        Parameters:
        elt - the sequence element that will be model's current value
        Throws:
        IllegalArgumentException - if the specified value isn't allowed
        See Also:
        SpinnerModel.setValue(java.lang.Object), getValue()

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