This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Get Programming with Java (MEAP only) and have Peggy Fisher on-line!
See this thread for details.
Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java 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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Keyboard layout problem  RSS feed

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,

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:
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!