1

I have created DateChooser panel using DateTimeSpinner with java. Is there any posibility to identify the mouse release moment of that dateTimeSpinner using ActioEvent?

  • There is no "DateTimeSpinner" in standard JDK; do you mean a `JSpinner` along with a `SpinnerDateModel` and a `JSpinner..DateEditor`? – Kevin Anderson Sep 12 '17 at 04:00
  • yes Kevin, I created it using those things – pubudu mahesh meththananda Sep 12 '17 at 04:05
  • Well there's no way to register an `ActionListener` on `JSpinner`, and thus no way to arrange to get an `ActionEvent`. How would knowing when the mouse button was released help you? Maybe there is another way to accomplish what you want. – Kevin Anderson Sep 12 '17 at 04:24
  • ok, another method that I have identified with MouseEventListener. But there is a problem also. when override the methods given, the mouse exited and mouse entered is working. but mouse released or mouse pressed or mouse clicked method are not fired. ? any suggestion – pubudu mahesh meththananda Sep 12 '17 at 05:00
  • If you are trying to execute an action each time the user changes the date selection, have a look at [addChangeListener](https://docs.oracle.com/javase/8/docs/api/javax/swing/JSpinner.html#addChangeListener-javax.swing.event.ChangeListener-) on `JSpinner`. – Kevin Anderson Sep 12 '17 at 05:24
  • yes,Kevin, According to my scenario, user can clicked the JSpinner button few seconds. During that period date is spinning. But I want to update my GUI using the last date which is remaining in the dateTimeSpinner textField. for that, I want to know the moment that, user release his mouse click. – pubudu mahesh meththananda Sep 12 '17 at 13:40
  • Problem soloved using another method. But another problem occured. When we released the Jspinner after long time pressed and once we hover the mouse, JSpinner start to spin without any force. any suggestion – pubudu mahesh meththananda Sep 13 '17 at 09:08
  • It sounds like whatever you did is interfering with the orderly delivery of mouse events to the `JSpinner`: the spinner got a `mousePressed` and so started spinning, but it never got a corresponding `mouseReleased` and so keeps on spinning. Must suggestion would be to forget about mouse events and try a `ChangeListener`. – Kevin Anderson Sep 13 '17 at 09:18

0 Answers0