Skip to content
Advertisement

Tag: jspinner

Selecting a part of text in JSpinner on click

I have a JSpinner with SpinnerDateModel. I want when users click on any part of the editor (the date, month, or year), it will automatically select them. So I wrote this: But when the first time it clicked, nothing happened. Although when I click it again, it works perfectly. Where’s wrong with my code? Answer From the documentation of MouseAdapter#mousePressed():

Advertisement