Embedding a JButton in a JTextArea or JLabel.

Hi,

I am trying to figure out how to integrate a JButton into a text block.

The idea is that the user is presented with instructions on how to solve a problem for instance how to switch on standby electric power when operating a generator.

The instructional text would have a colour-highlighted text string, lets saySTANDBY ELECTRIC POWER"embeded" at the appropriate place and the user clicks on it to access the detailed instructions of how to switch on this case standby electric power.

The instruction could look something like the following:

"If the generator voltage drops below a minimum of 24 volts switch on theSTANDBY ELECTRIC POWER and ensure that the voltage is 28 volts".

Clicking on this text string would then direct the user to a detailed explanation of how he/she should proceed to get and monitor standby electric power.

I image that using a JLabel or JTextArea and "embeding" a JButton at exactly the place indicated would do the job. Maybe there is a better way?

Does anyone have any ideas?

Many tks

John

[1121 byte] By [jpashleya] at [2007-11-26 16:25:27]
# 1
Use a JEditorPane and add a HyperLinkListener. The API has an example.
camickra at 2007-7-8 22:49:30 > top of Java-index,Desktop,Core GUI APIs...
# 2
Tks I'll give it a try and revert.John
jpashleya at 2007-7-8 22:49:30 > top of Java-index,Desktop,Core GUI APIs...