Oct 4, 2002 #1 youngun Programmer Apr 27, 2001 61 US I have a ticker program, and I want the text in the display window(frame) to be clickable, and redirect to a web page with browser pop out. Thank you very much.
I have a ticker program, and I want the text in the display window(frame) to be clickable, and redirect to a web page with browser pop out. Thank you very much.
Oct 5, 2002 #2 Blaxo Programmer Sep 3, 2002 49 NL You can add a MouseListener to the component with the text like this: component.addMouseListener(new MouseHandler()); then you create an inner class MouseHandler which handles the mouse events like this: private class MouseHandler extends MouseAdapter { public void mouseClicked(MouseEvent e){ // redirect to page } } I don't know how to do the browser popup (yet... ;-)) regards, Blaxo Upvote 0 Downvote
You can add a MouseListener to the component with the text like this: component.addMouseListener(new MouseHandler()); then you create an inner class MouseHandler which handles the mouse events like this: private class MouseHandler extends MouseAdapter { public void mouseClicked(MouseEvent e){ // redirect to page } } I don't know how to do the browser popup (yet... ;-)) regards, Blaxo
Oct 5, 2002 Thread starter #3 youngun Programmer Apr 27, 2001 61 US Blaxo, Will this work for dynamic text display? Because ticker program display real-time information. Thank you. Youngun Upvote 0 Downvote
Blaxo, Will this work for dynamic text display? Because ticker program display real-time information. Thank you. Youngun
Oct 6, 2002 #4 Blaxo Programmer Sep 3, 2002 49 NL It depends on how you display your text... Do you use a (J)Label? Or do you draw it on a Canvas or something? And even if you do, all these Components recognize the mouseClicked event, so it will work I think. regards, Blaxo Upvote 0 Downvote
It depends on how you display your text... Do you use a (J)Label? Or do you draw it on a Canvas or something? And even if you do, all these Components recognize the mouseClicked event, so it will work I think. regards, Blaxo