Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
243 views
in Technique[技术] by (71.8m points)

java - Append text in JLabel

How would I go about achieving the effect of JTextArea with JLabel?

I want the output to be displayed every time the button is clicked on the next line down instead of replacing what text is already there, i.e. like an append method for JLabel?

I just want it to follow the same behavior as JTextArea.append.

Also I want to add hyperlink to each line.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can do that as follows,

label.setText(label.getText() + "text u want to append");

on each event.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...