• 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

Short cut keys

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My problem is , i have TabbedPane in that have 3 panel, i want to select those pane with keys, no through mouse, how to do that,

vat i have done is


if(evt.getKeyCode()==evt.VK_1){
jPanel2.setFocusable(true);

}
if(evt.getKeyCode()==evt.VK_2){
jPanel3.setFocusable(true);
}
if(evt.getKeyCode()==evt.VK_3){
jPanel4.setFocusable(true);
}

this is not working, how to do that plz hepl me


kalai
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kalai,

try to use myTabbedPane.setSelectedIndex(<x> ) where <x> is the index of the tab in the TabbedPane. setFousable(true) will only make it possible for the component (in your case jPanel1 to jPanel4) to receive the Focus which is true by default.
You can also use myTabbedPane.setSelectedComponent(jPanel1).

Frank
[ October 07, 2005: Message edited by: Frank Ertl ]
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use the tab key to navigate through your gui. You can also bind KeyStrokes to your JTabbedPane, see How to Use KeyBindings. Or you can customize the focus cycle with a FocusTraversalPolicy, see How to Use the Focus Subsystem.
 
I want my playground back. Here, I'll give you this tiny ad for it:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic