Text in JEditorPane with links to actions

H

HawkLane

My boss wants us to have like a help document in a Swing application.
This means that if the user clicks on a special term (underlined), the
"help text" (explanation of the term) is shown, whether in a pop-up window
or something else. Is the best way to do this using a HyperlinkListener or
something else?
 
M

markspace

My boss wants us to have like a help document in a Swing application.
This means that if the user clicks on a special term (underlined), the
"help text" (explanation of the term) is shown, whether in a pop-up
window or something else. Is the best way to do this using a
HyperlinkListener or something else?

I see JavaFx links are being added to the Java tutorial, by Oracle. I
think you'd be remiss to not think about JavaFX. Here's the link from
the tutorial:

<http://docs.oracle.com/javafx/2/ui_controls/editor.htm>

However my personal experience is "I dunno." In general you do use
HyperlinkListener to implement links with a JEditorPane. Whether that's
a good idea for "help text" is beyond my ken.

You should probably also have a look at JavaHelp if you stick to Swing.
However I've seen some people claim it's too complicated for what it
does. Rolling your own help in Java seems a popular option.

<http://javahelp.java.net/>
 
R

Roedy Green

My boss wants us to have like a help document in a Swing application.
This means that if the user clicks on a special term (underlined), the
"help text" (explanation of the term) is shown, whether in a pop-up window
or something else. Is the best way to do this using a HyperlinkListener or
something else?

Fill it full of stylised, perfect, simplified HTML. Then you can get
notified when someone clicks on something.
 
H

HawkLane

Thank you for your help very nice. This works, but we want the use to be
able to switch from editable to non-editable (system will find what words
should be underlined).

When I go to the editable state, the text that I type after the linked
word is also with href formatting, i.e. blue and underlined, how can I
make it plain again instead?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top