David Qiao's Blog

Arrow key support in ButtonPanel

by David Qiao on Jun.22, 2008, under JIDE, Java and Swing

There is one missing feature in ButtonPanel. That’s the arrow key support. On Windows (probably on Mac as well), people get used to use left or right keys to navigate among buttons on a horizontal button panel or up/down keys for vertical button panel. However Swing doesn’t have that. For example, in the JOptionPane, arrow keys don’t change button focus. So I decide to add this feature. it has about 200 lines simple code. I included it below. The javadoc tells you how to use it. It is already checked in to JIDE Common Layer so feel free to check it out and use it. JIDE’s ButtonPanel called it already. JideOptionPane, since it uses ButtonPanel, also works beautifully.

:,

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!