The Artima Developer Community
Sponsored Link

Java Answers Forum
Key Accelerators

3 replies on 1 page. Most recent reply: Jan 22, 2004 4:24 AM by mausam

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Lynn Robertson

Posts: 4
Nickname: looloo
Registered: Dec, 2003

Key Accelerators Posted: Jan 21, 2004 6:40 PM
Reply to this message Reply
Advertisement
Hi All!
Just a couple of questions. How do I code the keyboard accelerator Ctrl+Alt? I've found lots of stuff on how to code if you're using only one or the other but not both at the same time.

The other question I have has to do with null strings. I've got a "clear" button set up and the actionlistener coded, but what code do I use to make it clear all textfields when clicked?

All suggestions appreciated!

Lynn


Sachin Joshi

Posts: 12
Nickname: aspire
Registered: Jan, 2004

Re: Key Accelerators Posted: Jan 21, 2004 11:48 PM
Reply to this message Reply
Hi Lynn,

I have a suggestion for your second question of clearing all text fields. As I am giving this suggestion without being aware of the current design of your system, please feel free to comment on it if you feel so.
I suggest you to keep a Collection may be ArrayList or any other, to store the objects of all textfields. On click of "clear" button, iterate this collection and clear the data from all objects. Then call the repaint() of your container to see the effect of the change you made.

Bye

mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: Key Accelerators Posted: Jan 22, 2004 3:36 AM
Reply to this message Reply
will it help??

setAccelerator(KeyStroke.getKeyStroke('V', java.awt.Event.SHIFT_MASK + java.awt.Event.CTRL_MASK, false));
if u want to use ctrl+alt+V

mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: Key Accelerators Posted: Jan 22, 2004 4:24 AM
Reply to this message Reply
textField.setText(""); for all the textFields

Flat View: This topic has 3 replies on 1 page
Topic: food chain simulation in java Previous Topic   Next Topic Topic: Conter for Page Hits

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use