File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes drawChars and onclick Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "drawChars and onclick" Watch "drawChars and onclick" New topic
Author

drawChars and onclick

Robert Kennedy
Ranch Hand

Joined: Jun 27, 2008
Posts: 63
Hello,

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 JLabel component at the precise coordinates as the drawChars woudl have rendered.

Thanks!
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

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: http://aspose.com/file-tools
 
subject: drawChars and onclick
 
Similar Threads
Script for clickOn() text will change the image
disabled attribute not rendered in commandButton
form validator to check for alphabets in a text field
Double buffering / drawChars / flickering
assign a function to the anchor via javascript.