A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Head First Android
this week in the
Swing / AWT / SWT
drawChars and onclick
Joined: Jun 27, 2008
Dec 06, 2010 10:52:11
Is it possible t o add an onclick handler (via a mask or directly to the text) to text rendered via drawChars.
if not how would i render a
component at the precise coordinates as the drawChars woudl have rendered.
Joined: Jul 26, 2007
Dec 06, 2010 19:58:07
One possible way.
When you invoke drawChars, compute and store int bounds as a Rectangle.
Add a mouse listener to the container on which the chars are drawn
When the user clicks, check if the click was inside any of the rectangles
How to ask questions
Donate a pint, save a life!
Onff-turn it on!
I agree. Here's the link:
subject: drawChars and onclick
Double buffering / drawChars / flickering
Script for clickOn() text will change the image
disabled attribute not rendered in commandButton
form validator to check for alphabets in a text field
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015