Results 1 to 3 of 3
  1. #1
    swati.jyoti is offline Member
    Join Date
    Mar 2009
    Rep Power

    Question firing an event as soon as value (in SpinnerNumber model) is deleted

    I have created hours and minutes using JSpinner()(SpinnerNumberModel).
    private JSpinner spHrs;
    private JSpinner spMin;

    this.spHrs = new JSpinner();
    this.spMin= new JSpinner();

    this.spHrs.setModel(new SpinnerNumberModel(0, 0, 999, 1));
    this.spMin.setModel(new SpinnerNumberModel(0, 0, 59, 1);;

    User is required to select hours(range 1-999) and min(range 1-59) and then click save.
    Problem is that whenever user deletes any value in spHours model,and then click save
    the original value is restored since the spHours(or spMinutes) cannot take any null value or any alphanumeric value.

    Requirement is..
    whenever user deletes any value in sphrs or spMin, a dialog box should appear asking "Do you want to restore the original value or replace the vaue with 0"
    Anyway my problem is that,I am not able to fire any event on deleting the value,it gets restored as soon as I go to change the value of spmin and vice versa?

    Any help is highly appreciated..

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power


    Why aren't you using a SpinnerDateModel?


  3. #3
    swati.jyoti is offline Member
    Join Date
    Mar 2009
    Rep Power

Similar Threads

  1. Replies: 3
    Last Post: 04-06-2011, 03:48 AM
  2. nodeChanged() not firing/working?
    By PrinceSendai in forum AWT / Swing
    Replies: 2
    Last Post: 03-24-2011, 03:29 AM
  3. setText is not firing...! Why?
    By N00Bie in forum New To Java
    Replies: 14
    Last Post: 02-20-2011, 09:59 PM
  4. Event-Driven Painting With Data Model
    By ThatJavaGuy in forum Java 2D
    Replies: 6
    Last Post: 02-15-2011, 03:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts