*
The moose likes Java in General and the fly likes Help me! GUI gurus. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Help me! GUI gurus." Watch "Help me! GUI gurus." New topic
Author

Help me! GUI gurus.

xiao li
Greenhorn

Joined: Apr 09, 2002
Posts: 13
I need to set mnemonic key for the title of the
tabbedpane, so user can use ALT+mnemonicKey to access different tabbedPane directly.
Thanks a lot!!!
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Well, if you are using 1.4 you can just setMnemonicAt(int tabIndex, int mnemonic).

setMnemonicAt
public void setMnemonicAt(int tabIndex,
int mnemonic)
Sets the keyboard mnemonic for accessing the specified tab. The mnemonic is the key which when combined with the look and feel's mouseless modifier (usually Alt) will activate the specified tab.
A mnemonic must correspond to a single key on the keyboard and should be specified using one of the VK_XXX keycodes defined in java.awt.event.KeyEvent. Mnemonics are case-insensitive, therefore a key event with the corresponding keycode would cause the button to be activated whether or not the Shift modifier was pressed.
This will update the displayed mnemonic property for the specified tab.

Parameters:
tabIndex - the index of the tab that the mnemonic refers to
mnemonic - the key code which represents the mnemonic
Throws:
IndexOutOfBoundsException - if tabIndex is out of range (tabIndex < 0 || tabIndex >= tab count)
Since:
1.4

If not - I suggest that you read the code for how they did it in 1.4 and do that yourself.


"JavaRanch, where the deer and the Certified play" - David O'Meara
xiao li
Greenhorn

Joined: Apr 09, 2002
Posts: 13
Thanks Cindy, you are my saver.
xiao li
Greenhorn

Joined: Apr 09, 2002
Posts: 13
Hi Guru,
could you tell me where can i download java1.4 source code? thanks a lot!
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Its part of the sdk1.4.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Help me! GUI gurus.
 
Similar Threads
Haw to separate a frame to diferent fraims
JPanel question ...
Ctreating tabs
How to place the Tab in JTabbedPane on the right hand side of the tabbedpane
JTabbedPane not refreshing