Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Giving focus to JPanel when Down arrow is pressed from JButton

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have four to five JButton in my frame. When i am clicking the first button, I dynamically displaying some JPanels. I have keyListener for the JButtons.
The focus is defaultly set to first button.
If i press Down Arrow i want to focus the first panel, at the same time i want to remove focus from the clicked JButton.

Give some ideas regarding this issue as soon as possible
Ranch Hand
Posts: 759
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends, welcome to the JavaRanch.

First, if you have 5 buttons, I'm afraid that you implement all the GUI functionality. My spec only require me to provide GUI functionality to search and book only so I only had 2 buttons. May I know What assignment did you retrieve and the version ?

Second, I don't know the benefit to focus on JPanel. I didn't do that in my assignment.

Remember, simplicity is the key.

Good Luck !!! and Wish me luck too !!!

Jeffry Kristianto Yanuar (Java Instructor)
SCJP 5.0, SCJA, SCJD (UrlyBird 1.3.2) --> Waiting for the result
[ December 05, 2008: Message edited by: Jeffry Kristianto Yanuar ]
What's brown and sticky? ... a stick. Or a tiny ad.
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic