a multiline display of text on the screen. Sometimes you permit the user to edit it. You can control where the line breaks are by embedding '\n' characters in your text. The AWT (Advanced Windowing Toolkit) equivalent is called a TextArea. AWT TextArea has an advantage over JTextArea.
Without any coding, with AWT, the user can select, copy and paste, even in an unsigned Applet. However, Applets must be signed for copy/paste to work in Swing. Copy/paste works in Swing without signing for applications.
JTextAreas have use the same font size and colours throughout. If you want to vary them, you will need a JTextPane or a JTextEditorPane.
For a complex display, consider generating a page of HTML (Hypertext Markup Language), XHTML (extensible Hypertext Markup Language) or XML (extensible Markup Language) on the fly, then rendering it, perhaps in an iframe, in a separate browser window, or a separate browser task. Then you can use elaborate CSS (Cascading Style Sheets) style sheets, rowspan and colspan tables. Verifying generated HTML is a snap.
By default JTextArea will not automatically wrap text. You must embed '\n' charactercs in your text where you want the line breaks. To get automatic line wrapping, you need two calls: JTextArea.setLineWrap( true ) and JTextArea.setWrapStyleWord( true ).
This page is posted |
http://mindprod.com/jgloss/jtextarea.html | |
Optional Replicator mirror
|
J:\mindprod\jgloss\jtextarea.html | |
Please read the feedback from other visitors,
or send your own feedback about the site. Contact Roedy. Please feel free to link to this page without explicit permission. | ||
Canadian
Mind
Products
IP:[65.110.21.43] Your face IP:[3.144.6.144] |
| |
Feedback |
You are visitor number | |