Results 1 to 6 of 6

Thread: What is the use of SpinnerListModel class?

  1. #1
    Join Date
    Dec 2009
    Posts
    68

    What is the use of SpinnerListModel class?

    Hello guys,

    I have to discuss one of my confusion related to the java classes. In advanced java the concept of classes are quite complicated to understand. I am getting troubled while understanding the 'SpinnerListModel class' of java. I don't have any idea about this java class. I wonder if you are able to provide me some details about the 'SpinnerListModel class' of java wit proper example. I am waiting for your reply.

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Re: What is the use of SpinnerListModel class?

    Hi friend,

    The SpinnerListModel class of advanced java is related to the configuration of the list array. The SpinnerListModel class is implements the 'Serializable' class. This class also extends 'AbstractSpinnerModel' class. The simple use of SpinnerListModel class is to define list or an array. The SpinnerListModel class is mostly have inheritance of a ChangeListener. This method of SpinnerListModel class is changed whenever the there is modification in it's properties.

  3. #3
    Join Date
    Feb 2008
    Posts
    1,852

    Re: What is the use of SpinnerListModel class?

    Hi,

    Please study following example of SpinnerListModel class, which will depict you the use of this class:
    Code:
    import javax.swing.JSpinner;
    import javax.swing.SpinnerListModel;
    import javax.swing.SpinnerModel;
    
    public class MainClass1 {
    
      public static void main(final String args[]) {
        JFrame frameC = new JFrame("JSpinner Dates");
        frameC.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
        SpinnerModel modelC1 = new SpinnerListModel();
        JSpinner spinnerC1 = new JSpinner(modelC1);
        JLabel labelC1 = new JLabel("None");
        JPanel panelC1 = new JPanel(new BorderLayout());
    
        panel1.add(labelC1, BorderLayout.CENTER);
        panel1.add(spinnerC1, BorderLayout.WEST);
    
        frame.add(panelC1, BorderLayout.NORTH);
        frame.setSize(300, 80);
        frame.setVisible(true);
    
      }
    
    }

  4. #4
    Join Date
    Jan 2008
    Posts
    1,521

    Re: What is the use of SpinnerListModel class?

    Refer following some essential methods of the SpinnerListModel class of java:
    • setValue(Object et)
    • getValue()
    • setList(List lst)
    • getPreviousValue()
    • getNextValue()
    • getList()

  5. #5
    Join Date
    Apr 2008
    Posts
    1,948

    Re: What is the use of SpinnerListModel class?

    See the following example of SpinnerListModel class. In which I have used many methods of SpinnerListModel class:
    Code:
    import javax.swing.SpinnerModel;
    
    public class MClass 
    {
      public static void main(String arg[]) {
        JFrame fz = new JFrame("JSpinner Sample");
        fz.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        DateFormatSymbols symbolsz = new DateFormatSymbols(Locale.FRENCH);
        String days[] = symbolsz.getWeekdays();
        SpinnerModel modelz1 = new SpinnerListModel(days);
        SpinnerModel modelz2 = new SpinnerDateModel();
        JSpinner spinnerz1 = new JSpinner(modelz1);
        JSpinner spinnerz2 = new JSpinner(modelz2);
        fz.add(spinnerz1, BorderLayout.NORTH);
        fz.add(spinnerz2, BorderLayout.SOUTH);
        fz.setSize(400, 100);
        fz.setVisible(true);
      }
    }

  6. #6
    Join Date
    May 2008
    Posts
    2,012

    Re: What is the use of SpinnerListModel class?

    The SpinnerListModel is very often used class of java. 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. Simply this is used for the implementation of list.

Similar Threads

  1. Replies: 8
    Last Post: 08-10-2011, 11:06 PM
  2. What is the difference between Local class and global class in C++?
    By Dëfrim in forum Software Development
    Replies: 4
    Last Post: 03-01-2011, 10:44 PM
  3. Replies: 5
    Last Post: 12-02-2010, 06:23 PM
  4. Ultra solid drives:Imation M-Class and S-Class
    By Regina in forum Portable Devices
    Replies: 1
    Last Post: 03-04-2009, 10:34 AM
  5. Good news for CBSE CLASS X & CLASS IX - visit learnnext
    By surya_expert in forum Education Career and Job Discussions
    Replies: 0
    Last Post: 13-12-2008, 12:09 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,415,903.31199 seconds with 16 queries