KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > javax > swing > JSpinner

javax.swing
Class JSpinner

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JSpinner
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
See Also:
Top Examples, Source Code, XMLEncoder, SpinnerModel, AbstractSpinnerModel, SpinnerListModel, SpinnerNumberModel, SpinnerDateModel, JFormattedTextField

public void addChangeListener(ChangeListener listener)
See Also:
getModel(), removeChangeListener(javax.swing.event.ChangeListener)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void commitEdit()
                throws ParseException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected JComponent createEditor(SpinnerModel model)
See Also:
setEditor(javax.swing.JComponent), getModel()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected void fireStateChanged()
See Also:
EventListenerList, removeChangeListener(javax.swing.event.ChangeListener), addChangeListener(javax.swing.event.ChangeListener)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public AccessibleContext getAccessibleContext()
See Also:
JComponent, Accessible
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public ChangeListener[] getChangeListeners()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public JComponent getEditor()
See Also:
createEditor(javax.swing.SpinnerModel), setEditor(javax.swing.JComponent)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public SpinnerModel getModel()
See Also:
setModel(javax.swing.SpinnerModel)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Object getNextValue()
See Also:
getPreviousValue(), getValue()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Object getPreviousValue()
See Also:
getNextValue(), getValue()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public SpinnerUI getUI()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getUIClassID()
See Also:
UIDefaults.getUI(javax.swing.JComponent), JComponent
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Object getValue()
See Also:
setValue(java.lang.Object)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public JSpinner()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public JSpinner(SpinnerModel model)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[76]Spinner
By Anonymous on 2004/02/07 15:47:28  Rate
import javax.swing.*; 
 import javax.swing.event.*; 
 import java.text.*; 
 import java.awt.*; 
 import java.util.*; 
  
  
 public class Spinner  {  
   public static void main  ( String args [  ]  )  throws Exception  {  
     JFrame frame = new JFrame ( "Spinner" ) ; 
     frame.setDefaultCloseOperation ( 3 ) ; 
     String [  ]  months = new DateFormatSymbols (  ) .getMonths (  ) ; 
     SpinnerModel model = new SpinnerListModel ( months ) ; 
     JSpinner spinner = new JSpinner ( model ) ; 
     frame.getContentPane (  ) .add ( spinner, BorderLayout.NORTH ) ; 
  
  
     SpinnerDateModel model2 = new SpinnerDateModel (  ) ; 
     model2.setCalendarField ( Calendar.WEEK_OF_MONTH ) ; 
     JSpinner spinner2 = new JSpinner ( model2 ) ; 
     JSpinner.DateEditor editor2 = new JSpinner.DateEditor (  
       spinner2, "MMMMM dd, yyyy" ) ; 
     spinner2.setEditor ( editor2 ) ; 
     frame.getContentPane (  ) .add ( spinner2, BorderLayout.SOUTH ) ; 
  
  
     SpinnerNumberModel model3 = new SpinnerNumberModel ( 50, 0, 100, 5 ) ; 
     JSpinner spinner3 = new JSpinner ( model3 ) ; 
     frame.getContentPane (  ) .add ( spinner3, BorderLayout.CENTER ) ; 
  
  
     ChangeListener listener = new ChangeListener (  )   {  
       public void stateChanged ( ChangeEvent e )   {  
         SpinnerModel source =  ( SpinnerModel ) e.getSource (  ) ; 
         System.out.println ( "The value is: " + source.getValue (  )  ) ; 
        }  
      } ; 
     model.addChangeListener ( listener ) ; 
     model2.addChangeListener ( listener ) ; 
     model3.addChangeListener ( listener ) ; 
  
  
     frame.pack (  ) ; 
     frame.show (  ) ; 
    }  
  } 


public void removeChangeListener(ChangeListener listener)
See Also:
addChangeListener(javax.swing.event.ChangeListener), fireStateChanged()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setEditor(JComponent editor)
See Also:
getModel(), createEditor(javax.swing.SpinnerModel), getEditor(), IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setModel(SpinnerModel model)
See Also:
setEditor(javax.swing.JComponent), getEditor(), getModel(), IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setUI(SpinnerUI ui)
See Also:
UIDefaults.getUI(javax.swing.JComponent)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setValue(Object value)
See Also:
getValue(), IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void updateUI()
See Also:
UIManager.getUI(javax.swing.JComponent), JComponent
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags