Search code examples
swingeventsclojureseesaw

Is it possible to have a bulleted list with an event handler?


I'm using seesaw to program an interface in Swing.

I want to display a bulleted list of items. When an item is clicked I want an event handler to be called.

I have managed to get event handlers working for components/widgets, and I can display a bulleted list easily by inserting HTML into a Label. I figure that if nothing else is possible I may need to capture mouse click events for the parent and work out offsets.

What's the best way to have a clickable bulleted list with event handlers?


Solution

  • I think the easiest way would be to stick to widgets as much as possible. Working out offsets may become very difficult considering different font sizes and widget insets depending on platform. If you want to have a bullet list, why not simply put a bullet image in front of every label. This way you could easily listen for events on every individual label. Also, you won't constrain yourself to HTML which seesaw has no support for yet.