Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

ledestin.swing
Class YearsComboBoxModel  view YearsComboBoxModel download YearsComboBoxModel.java

java.lang.Object
  extended byjavax.swing.AbstractListModel
      extended byledestin.swing.YearsComboBoxModel
All Implemented Interfaces:
javax.swing.ComboBoxModel, javax.swing.ListModel, java.io.Serializable

public class YearsComboBoxModel
extends javax.swing.AbstractListModel
implements javax.swing.ComboBoxModel

The class provides a model for JComboBox allowing to select from a range of years. firstYear and lastYear properties can be set, confining the range of years.


Field Summary
private  java.util.Calendar firstYear
           
private  java.util.Calendar lastYear
           
private  int selectedYear
           
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
YearsComboBoxModel(int firstYear, int lastYear)
           
 
Method Summary
 java.lang.Object getElementAt(int index)
          Retrieves a data element at a specified index.
 int getFirstYear()
           
 int getLastYear()
           
 java.lang.Object getSelectedItem()
          Returns the currently selected item in the combo box.
protected  int getSelectedYear()
           
 int getSize()
          Return the number of data elements in the list.
static void main(java.lang.String[] args)
           
 void setFirstYear(int firstYear)
           
 void setLastYear(int lastYear)
           
 void setSelectedItem(java.lang.Object anItem)
          Sets the selected item in the combo box.
protected  void setSelectedYear(int year)
           
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.ListModel
addListDataListener, removeListDataListener
 

Field Detail

firstYear

private java.util.Calendar firstYear

lastYear

private java.util.Calendar lastYear

selectedYear

private int selectedYear
Constructor Detail

YearsComboBoxModel

public YearsComboBoxModel(int firstYear,
                          int lastYear)
Method Detail

setFirstYear

public void setFirstYear(int firstYear)
                  throws java.lang.IllegalArgumentException

getFirstYear

public int getFirstYear()

setLastYear

public void setLastYear(int lastYear)
                 throws java.lang.IllegalArgumentException

getLastYear

public int getLastYear()

setSelectedYear

protected void setSelectedYear(int year)

getSelectedYear

protected int getSelectedYear()

getElementAt

public java.lang.Object getElementAt(int index)
Description copied from interface: javax.swing.ListModel
Retrieves a data element at a specified index.

Specified by:
getElementAt in interface javax.swing.ListModel

getSize

public int getSize()
Description copied from interface: javax.swing.ListModel
Return the number of data elements in the list.

Specified by:
getSize in interface javax.swing.ListModel

setSelectedItem

public void setSelectedItem(java.lang.Object anItem)
Description copied from interface: javax.swing.ComboBoxModel
Sets the selected item in the combo box. Classes implementing this interface should fire a javax.swing.event.ListDataEvent to all registered javax.swing.event.ListDataListeners to indicate that the selection has changed.

Specified by:
setSelectedItem in interface javax.swing.ComboBoxModel

getSelectedItem

public java.lang.Object getSelectedItem()
Description copied from interface: javax.swing.ComboBoxModel
Returns the currently selected item in the combo box.

Specified by:
getSelectedItem in interface javax.swing.ComboBoxModel

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception