Can someone point me in the right direction for formatting text and aligninng text in a JTextField?
Thanks...
GlenRogers
0
Newbie Poster
Recommended Answers
Jump to PostJTextFields support a basic subset of HTML tags, so you can achieve a lot of formatting by setting the text of the JTextField to some valid HTML (start with <HTML> )
Jump to PostIf you replace your JTextArea with a JEditorPane the you can still use HTML to format the contents
http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-JEditorPane.htmlinstead of plain text you just add HTML tags, stuff kinda like
"<HTML><H1>" + gui.results.getText() + "<\H1><BR><center>Customer Signature ... etc
Jump to PostHTML <BR> tag is like a \n
Jump to PostInsert a "<br>" into your input wherever you want to start a new line.
Jump to PostThat should be "
<br>
" not "<br />
"
All 20 Replies
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
GlenRogers
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
GlenRogers
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
GlenRogers
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
GlenRogers
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
GlenRogers
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
GlenRogers
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
GlenRogers
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
GlenRogers
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
GlenRogers
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
GlenRogers
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.