Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Disable dropping feature in JSpinner

 
James Peter
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I need to avoid dropping of text inside the JSpinner control. Below is my code for custom transferHandler.
Even though canImport method is returning false I am able to drag and drop text into JSpinner.
I searched net but did not find proper solution. Please let me know if any one is having an idea how to do it.



Thanks
Peter
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you tried setting the spinner's
formattedTextfield's allowInvalidCharacters
to false?
(posting from phone, so method name
might not be exact)
 
James Peter
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Below code is working. thanks a lot.


Thanks
Peter
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
correct, but the method belongs to the
formattedTextfield of the spinner.

read the spinner docs to get the formattedTextfield

[edit]
thanks to the previous post being edited, my post now makes no sense.
I replied to the unedited post which said 'couldn't find the method in the JSpinner class'
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic