• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

How to select text in a Custom JSpinner

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i have a Custom Jspinner in a dialog box which i uses to show some string. i wanted to select this text when ever dialog box is called.
i am using foloowing code for the same but its not working.

 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> i am using foloowing code for the same but its not working.

"but its not working. " implies that it compiles and runs OK, but doesn't achieve the desired result.

I couldn't get your version to compile (please show us how you did it),
but my version of a 'compiled OK' selectAll() works fine.

so, get yours to compile and run, and it should work for you as well.
 
Sheriff
Posts: 22662
127
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about ft.selectAll(), without using the Formatter?
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JFormattedTextField inherits the selectAll method from JTextComponent
 
RajivR Singh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for Reply guys.

but i still finds same problem. mean while i noticed that my text field is getting selected and then selection is getting lost. this i noticed by giving some delay.
also i notice that there is a bug filed with Sun in 1.4 version related to this.

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4699955

i am using 1.5 version.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> mean while i noticed that my text field is getting selected and then selection is getting lost.

try using a timer
note: if the dialog is modal, you need this code prior to dialog.setVisible(true);

 
RajivR Singh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. with timer its working.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic