aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Keyboard layout problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Keyboard layout problem" Watch "Keyboard layout problem" New topic
Author

Keyboard layout problem

Bret Waldow
Ranch Hand

Joined: Aug 04, 2000
Posts: 58
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.
 
subject: Keyboard layout problem
 
Similar Threads
getScaledInstance() and resize event
Layout Problem, Help Me Plz
GridBagLayout Question: Irregular Spacing
GridBagLayout problem
GridBagLayout problems