Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Keyboard layout problem

 
Bret Waldow
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working out the gui for an on-screen keyboard to go with my handwriting recognition app for Linux. The keyboard is for primary text entry and correcting mis-recognitions.

Looking at most keyboards, I see some keys span the equivalent of 2 or 3 of the smallest ones. I'm trying to get that effect using GridBagLayout. I'd be happy to hear of another way as well.

I'm specifying the grid position of each key, and also it's weight, expecting that equal weights will provide equal widths, but the width of the characters on the keyface seems to be interfering - using a proportional font, the 'k' and ';' keys have a different width. Similarly, the 'BS' and 'Del' keys have differing widths regardless of the font.

How can I specify that I want an individual key to span 1x, 2x, 3x columns regardless of what's on the button face and always have x turn out to be the same width for all keys, even when the overall keyboard gets re-sized?

Thanks in advance,
Bret

A code snippet to show what I'm doing (it's just the first row of a 'fitaly' layout - not 'qwerty'). A 'standard' key spans 2 columns, and there are keys spanning 3 and 4 columns:
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic