Anyone Implement Hexagonal Buttons?

Hi all,

I'm thinking about implementing a virtual one-handed keyboard for people with typing difficulties,. The obvious button shape would be hexagonal to maximize real estate and minimize hand movement. Has anyone ever implemented hexagonal buttons? Just curious

Thanks.

Chris

[303 byte] By [batymohna] at [2007-11-27 5:13:48]
# 1

well one thing I can think of is creating one image with your buttons drawn on it and then map coordinates on that image. implement a mouselistener on that image (JLabel), and from the MouseEvent you can track the X and Y coordinate within the image that the user clicked, and map that X,Y location to a button on your image.

you could combine with a swing Timer to add some sort of short button animation to it when you click a button.

Just an idea, I wouldn't know if there are ways to actually create non-rectangular buttons using Swing. I haven't seen anything like that myself.

gimbal2a at 2007-7-12 10:35:35 > top of Java-index,Desktop,Core GUI APIs...
# 2

Well, if you are trying to maximize real estate, that presumes your hex buttons form rows which bump the sides up next to each other.

A normal means of making a hex button would be an image, but that would still be within the bounds of a rectangle. And images are fine, but you'd need to know the shape's bounds to know the hot spot of the button.

Might be easier in this case to create a set of shapes which appropriate bounds and paint them on a single panel. Then use a mouse listener to track the mouse to hilite the mouse overs or press the buttons.

bsampieria at 2007-7-12 10:35:35 > top of Java-index,Desktop,Core GUI APIs...
# 3

Thanks for the ideas. There is a one-hand keyboard that circular in nature and the most popular keys are in the center but the keys are hexagonal, because they fit ogether, like a honeycomb. But I can never remember seeing - anywhere - a hexagonal button in the computer world. I need to look at how Sun implented Button.

Thanks.

Chris

batymohna at 2007-7-12 10:35:35 > top of Java-index,Desktop,Core GUI APIs...
# 4
You might adapt this round button example from the tech tips: http://java.sun.com/developer/TechTips/txtarchive/1999/Aug99_PatrickC.txt-Puce
Pucea at 2007-7-12 10:35:35 > top of Java-index,Desktop,Core GUI APIs...