aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Disable dropping feature in JSpinner Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Disable dropping feature in JSpinner" Watch "Disable dropping feature in JSpinner" New topic
Author

Disable dropping feature in JSpinner

James Peter
Ranch Hand

Joined: Sep 15, 2010
Posts: 115
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

Joined: Jun 09, 2003
Posts: 4632
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

Joined: Sep 15, 2010
Posts: 115
Hi,
Below code is working. thanks a lot.


Thanks
Peter
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
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'
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Disable dropping feature in JSpinner