Results 1 to 6 of 6

Thread: Confused with 'Class SpinnerNumberModel'

  1. #1
    Join Date
    Dec 2009
    Posts
    38

    Confused with 'Class SpinnerNumberModel'

    Hello Friend,

    I am studying the java programming language. In which I am getting troubled while understanding the few concepts of java. According to me the class are very complicated functionality. I need your help to be aware about the 'Class SpinnerNumberModel' of java programming. I have referred many book over this concept, but nothing was helpful. I wonder if you are able provide me something about the Class SpinnerNumberModel. I am waiting for your reply.

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Confused with 'Class SpinnerNumberModel'

    Hi friend,

    The SpinnerNumberModel class related to the sequences of numbers. The upper and lower bounds of the sequence are defined by properties called minimum and maximum. The size of the increase or decrease computed by the nextValue and previousValue methods is defined by a property called stepSize. The minimum and maximum properties can be null to indicate that the sequence has no lower or upper limit.

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

    Re: Confused with 'Class SpinnerNumberModel'

    Please study following example of Class SpinnerNumberModel of java:
    Code:
    import javax.swing.SpinnerModel;
    import javax.swing.SpinnerNumberModel;
    import java.awt.BorderLayout;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JSpinner;
    
    public class SpinnerNumberDemo {
      public static void main(String arg[]) 
    {
        JFrame frame5 = new JFrame("JSpinner Sample");
        frame5.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        SpinnerModel model01 = new SpinnerNumberModel();
      
      JSpinner spinner01 = new JSpinner(model01);
        JLabel label01 = new JLabel("Numbers");
        JPanel panel01 = new JPanel(new BorderLayout());
        panel01.add(label1, BorderLayout.WEST);
        panel01.add(spinner1, BorderLayout.CENTER);
      
      frame5.add(panel1, BorderLayout.SOUTH);
        frame.setSize(150, 80);
        frame.setVisible(true);
      }
    }

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

    Re: Confused with 'Class SpinnerNumberModel'

    The 'Class SpinnerNumberModel' integrates four constructor, Refer following it's constructors with various parameters:
    1. SpinnerNumberModel(Number val, Comparable min, Comparable max, Number SizeofSize)
    2. SpinnerNumberModel(double val, double min, double max, double SizeofSize) SpinnerNumberModel()
    3. SpinnerNumberModel(int val, int min, int max, int SizeofSize)

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

    Re: Confused with 'Class SpinnerNumberModel'

    Hi

    I suggest you to refer below java code which will depict you the methods of SpinnerNumberModel class:
    Code:
    public SpinnerNumberModel(Number val, Comparable maximum, Comparable minimum, Number Size)
    Number value1 = new Integer(60);
    Number max1 = new Integer(150);
    Number min1 = new Integer(0);
    Number step1 = new Integer(2);
    SpinnerModel model = new SpinnerNumberModel(value1, min1, max1, step1);
    JSpinner spinner = new JSpinner(model);

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

    Re: Confused with 'Class SpinnerNumberModel'

    Hello friend,

    We can use number of method of SpinnerNumberModel class, some of them are mentioned below:
    • setValue(Object val)
    • setStepSize(Number SizeofStep)
    • setPreviousValue()
    • setMinimum(Comparable min)
    • getNextValue()
    • setMaximum(Comparable max)
    • getMinimum()

Similar Threads

  1. Confused about Scrollbar class
    By Jagruti23 in forum Software Development
    Replies: 5
    Last Post: 06-03-2010, 04:18 PM
  2. Confused about the List class
    By Jagruti23 in forum Software Development
    Replies: 5
    Last Post: 05-03-2010, 04:17 PM
  3. Confused with JInternalFrame class
    By Truster in forum Software Development
    Replies: 5
    Last Post: 17-02-2010, 09:58 AM
  4. Confused with JSpinner class
    By Bottlenecked in forum Software Development
    Replies: 4
    Last Post: 15-02-2010, 09:51 AM
  5. Confused with OverlayLayout class
    By Bottlenecked in forum Software Development
    Replies: 5
    Last Post: 12-02-2010, 09:37 AM

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,714,055,656.60852 seconds with 17 queries