API java : DefaultBoundedRangeModel


javax.swing
Class DefaultBoundedRangeModel

java.lang.Object
  extended by javax.swing.DefaultBoundedRangeModel
All Implemented Interfaces:
Serializable, BoundedRangeModel

public class DefaultBoundedRangeModel
extends Object
implements BoundedRangeModel, Serializable

A generic implementation of BoundedRangeModel.

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.

See Also:
BoundedRangeModel

Field Summary
protected  ChangeEvent changeEvent
          Only one ChangeEvent is needed per model instance since the event's only (read-only) state is the source property.
protected  EventListenerList listenerList
          The listeners waiting for model changes.
 
Constructor Summary
DefaultBoundedRangeModel()
          Initializes all of the properties with default values.
DefaultBoundedRangeModel(int value, int extent, int min, int max)
          Initializes value, extent, minimum and maximum.
 
Method Summary
 void addChangeListener(ChangeListener l)
          Adds a ChangeListener.
protected  void fireStateChanged()
          Runs each ChangeListener's stateChanged method.
 ChangeListener[] getChangeListeners()
          Returns an array of all the change listeners registered on this DefaultBoundedRangeModel.
 int getExtent()
          Returns the model's extent.
<T extends EventListener>
T[]
getListeners(Class<T> listenerType)
          Returns an array of all the objects currently registered as FooListeners upon this model.
 int getMaximum()
          Returns the model's maximum.
 int getMinimum()
          Returns the model's minimum.
 int getValue()
          Returns the model's current value.
 boolean getValueIsAdjusting()
          Returns true if the value is in the process of changing as a result of actions being taken by the user.
 void removeChangeListener(ChangeListener l)
          Removes a ChangeListener.
 void setExtent(int n)
          Sets the extent to n after ensuring that n is greater than or equal to zero and falls within the model's constraints:
 void setMaximum(int n)
          Sets the maximum to n after ensuring that n that the other three properties obey the model's constraints:
 void setMinimum(int n)
          Sets the minimum to n after ensuring that n that the other three properties obey the model's constraints:
 void setRangeProperties(int newValue, int newExtent, int newMin, int newMax, boolean adjusting)
          Sets all of the BoundedRangeModel properties after forcing the arguments to obey the usual constraints:
 void setValue(int n)
          Sets the current value of the model.
 void setValueIsAdjusting(boolean b)
          Sets the valueIsAdjusting property.
 String toString()
          Returns a string that displays all of the BoundedRangeModel properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

changeEvent

protected transient ChangeEvent changeEvent
Only one ChangeEvent is needed per model instance since the event's only (read-only) state is the source property. The source of events generated here is always "this".


listenerList

protected EventListenerList listenerList
The listeners waiting for model changes.

Constructor Detail

DefaultBoundedRangeModel

public DefaultBoundedRangeModel()
Initializes all of the properties with default values. Those values are:
  • value = 0
  • extent = 0
  • minimum = 0
  • maximum = 100
  • adjusting = false


DefaultBoundedRangeModel

public DefaultBoundedRangeModel(int value,
                                int extent,
                                int min,
                                int max)
Initializes value, extent, minimum and maximum. Adjusting is false. Throws an IllegalArgumentException if the following constraints aren't satisfied:
  1. min <= value <= value+extent <= max

Method Detail

getValue

public int getValue()
Returns the model's current value.

Specified by:
getValue in interface BoundedRangeModel
Returns:
the model's current value
See Also:
setValue(int), BoundedRangeModel.getValue()

getExtent

public int getExtent()
Returns the model's extent.

Specified by:
getExtent in interface BoundedRangeModel
Returns:
the model's extent
See Also:
setExtent(int), BoundedRangeModel.getExtent()

getMinimum

public int getMinimum()
Returns the model's minimum.

Specified by:
getMinimum in interface BoundedRangeModel
Returns:
the model's minimum
See Also:
setMinimum(int), BoundedRangeModel.getMinimum()

getMaximum

public int getMaximum()
Returns the model's maximum.

Specified by:
getMaximum in interface BoundedRangeModel
Returns:
the model's maximum
See Also:
setMaximum(int), BoundedRangeModel.getMaximum()

setValue

public void setValue(int n)
Sets the current value of the model. For a slider, that determines where the knob appears. Ensures that the new value, n falls within the model's constraints:
  1. minimum <= value <= value+extent <= maximum

Specified by:
setValue in interface BoundedRangeModel
Parameters:
n - the model's new value
See Also:
BoundedRangeModel.setValue(int)

setExtent

public void setExtent(int n)
Sets the extent to n after ensuring that n is greater than or equal to zero and falls within the model's constraints:
  1. minimum <= value <= value+extent <= maximum

Specified by:
setExtent in interface BoundedRangeModel
Parameters:
n - the model's new extent
See Also:
BoundedRangeModel.setExtent(int)

setMinimum

public void setMinimum(int n)
Sets the minimum to n after ensuring that n that the other three properties obey the model's constraints:
  1. minimum <= value <= value+extent <= maximum

Specified by:
setMinimum in interface BoundedRangeModel
Parameters:
n - the model's new minimum
See Also:
getMinimum(), BoundedRangeModel.setMinimum(int)

setMaximum

public void setMaximum(int n)
Sets the maximum to n after ensuring that n that the other three properties obey the model's constraints:
  1. minimum <= value <= value+extent <= maximum

Specified by:
setMaximum in interface BoundedRangeModel
Parameters:
n - the model's new maximum
See Also:
BoundedRangeModel.setMaximum(int)

setValueIsAdjusting

public void setValueIsAdjusting(boolean b)
Sets the valueIsAdjusting property.

Specified by:
setValueIsAdjusting in interface BoundedRangeModel
Parameters:
b - true if the upcoming changes to the value property are part of a series
See Also:
getValueIsAdjusting(), setValue(int), BoundedRangeModel.setValueIsAdjusting(boolean)

getValueIsAdjusting

public boolean getValueIsAdjusting()
Returns true if the value is in the process of changing as a result of actions being taken by the user.

Specified by:
getValueIsAdjusting in interface BoundedRangeModel
Returns:
the value of the valueIsAdjusting property
See Also:
setValue(int), BoundedRangeModel.getValueIsAdjusting()

setRangeProperties

public void setRangeProperties(int newValue,
                               int newExtent,
                               int newMin,
                               int newMax,
                               boolean adjusting)
Sets all of the BoundedRangeModel properties after forcing the arguments to obey the usual constraints:
  1. minimum <= value <= value+extent <= maximum

At most, one ChangeEvent is generated.

Specified by:
setRangeProperties in interface BoundedRangeModel
Parameters:
newValue - an int giving the current value
newExtent - an int giving the amount by which the value can "jump"
newMin - an int giving the minimum value
newMax - an int giving the maximum value
adjusting - a boolean, true if a series of changes are in progress
See Also:
BoundedRangeModel.setRangeProperties(int, int, int, int, boolean), setValue(int), setExtent(int), setMinimum(int), setMaximum(int), setValueIsAdjusting(boolean)

addChangeListener

public void addChangeListener(ChangeListener l)
Adds a ChangeListener. The change listeners are run each time any one of the Bounded Range model properties changes.

Specified by:
addChangeListener in interface BoundedRangeModel
Parameters:
l - the ChangeListener to add
See Also:
removeChangeListener(javax.swing.event.ChangeListener), BoundedRangeModel.addChangeListener(javax.swing.event.ChangeListener)

removeChangeListener

public void removeChangeListener(ChangeListener l)
Removes a ChangeListener.

Specified by:
removeChangeListener in interface BoundedRangeModel
Parameters:
l - the ChangeListener to remove
See Also:
addChangeListener(javax.swing.event.ChangeListener), BoundedRangeModel.removeChangeListener(javax.swing.event.ChangeListener)

getChangeListeners

public ChangeListener[] getChangeListeners()
Returns an array of all the change listeners registered on this DefaultBoundedRangeModel.

Returns:
all of this model's ChangeListeners or an empty array if no change listeners are currently registered
Since:
1.4
See Also:
addChangeListener(javax.swing.event.ChangeListener), removeChangeListener(javax.swing.event.ChangeListener)

fireStateChanged

protected void fireStateChanged()
Runs each ChangeListener's stateChanged method.

See Also:
setRangeProperties(int, int, int, int, boolean), EventListenerList

toString

public String toString()
Returns a string that displays all of the BoundedRangeModel properties.

Overrides:
toString in class Object
Returns:
a string representation of the object.

getListeners

public <T extends EventListener> T[] getListeners(Class<T> listenerType)
Returns an array of all the objects currently registered as FooListeners upon this model. FooListeners are registered using the addFooListener method.

You can specify the listenerType argument with a class literal, such as FooListener.class. For example, you can query a DefaultBoundedRangeModel instance m for its change listeners with the following code:

  1. ChangeListener[] cls = (ChangeListener[])(m.getListeners(ChangeListener.class));
If no such listeners exist, this method returns an empty array.

Parameters:
listenerType - the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener
Returns:
an array of all objects registered as FooListeners on this model, or an empty array if no such listeners have been added
Throws:
ClassCastException - if listenerType doesn't specify a class or interface that implements java.util.EventListener
Since:
1.3
See Also:
getChangeListeners()

Ces informations proviennent du site de http://java.sun.com

Remarques

Contenu

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 :

Quels sont les motivations de cette démarche?

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.

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

6 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.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-2610
Document créé le 31/08/06 00:43, dernière modification le Vendredi 17 Juin 2011, 12:12
Source du document imprimé : http://www.gaudry.be/java-api-rf-javax/swing/DefaultBoundedRangeModel.html Document affiché 1 fois ce mois de Juin.
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
15832 documents
452 astuces.
549 niouzes.
3099 definitions.
447 membres.
8115 messages.

Document genere en :
1,06 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
Les experts sont formels et unanimes : en règle générale, l'ordinateur le mieux adapté à vos besoins est commercialisé environ deux jours après que vous ayez acheté un autre modèle !

Dave Barry
 
l'infobrol
Nous sommes le Samedi 02 Juin 2012, 03:41, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)