• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SelectAll in edit menu

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i dont want to use Focus Listeners,so if i want to implement selectAll menu item functionality (in Edit menu) how can i do?
 
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Put all the menuitems in an array and loop thru the array setting the menuitems as selected.
 
Nidhi Dave
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me make it clear...

Suppose i've some textfields and some combo boxes on a screen.
If the user types some info in one text field (ex : address for emergency contact )and wants to repeat the same info in another textfield (ex : permanent address) he can go to the Edit menu -> Select All option on the text he wants to select and say "Copy" and go to the field where he wants to repeat the info and say "Paste" ..i hope it's clear now..
So now if i want to know on which component the user clicked on Select All
i should know which component has the current focus...and for
this generally we go for Foucus Listeners but as i've components large in number i can't do that ..so can any one help me out soon...
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand why you can't use a FocusListener. It seems to me that you can obtain the Component that has focus by calling getComponent() on the FocusEvent object that is sent to the methods of the FocusListener. How does the number of components in your application affect this?

Layne
 
Norm Radder
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure why you need to do it.
On my system Win98, if I have two textfields in a Java app and I rightclick on one, I get a menu that allows me to Select All and then to Copy and then to Paste. This is an AWT app not Swing.
So java already provides the capability that you are trying to provide.
 
reply
    Bookmark Topic Watch Topic
  • New Topic