clickable text

Is there a way to make text clickable, kind of like hypertext, but then have an ActionListener for it? I was thinking there was some way to just change the look of a JButton, but I can't figure out how...Thanks
[225 byte] By [snoboardera] at [2007-11-27 6:16:36]
# 1

> Is there a way to make text clickable, kind of like

> hypertext, but then have an ActionListener for it? I

> was thinking there was some way to just change the

> look of a JButton, but I can't figure out how...

In future Swing related questions should be posted into the Swing forum.

Is the second bit (in bold) a different question or the same question posed a different way?

Have you seen this http://java.sun.com/docs/books/tutorial/uiswing/components/button.html

cotton.ma at 2007-7-12 17:28:29 > top of Java-index,Java Essentials,New To Java...
# 2

That second part was just me thinking of a suggestion - I had already looked at that tutorial and as far as I can tell you can only change the look of the button when it is disabled, and even that still has the box around it

I posted this here because I figured that the solution might not be in Swing. The only possible Swing answer would be JButton, but there might be another way.

snoboardera at 2007-7-12 17:28:29 > top of Java-index,Java Essentials,New To Java...
# 3

Why don't you just add text to a label and then add a listener to the label?

If you want a hyper link type effect with the underline then you can use a JEditorPane which can display HTML. You can actually dress it to look like a button by tweaking various parts such as back ground colour and border.

_helloWorld_a at 2007-7-12 17:28:29 > top of Java-index,Java Essentials,New To Java...
# 4
hmm, that might work, I'm gonna have to look up using JEditorPanesThanks
snoboardera at 2007-7-12 17:28:29 > top of Java-index,Java Essentials,New To Java...