Is there a JParagraph
I'm wondering if there's a swing item that's like a JLabel except that it spans many lines, like a JParagraph. If I write
JLabel L = new JLabel("line 1\nline2");
What gets displayed in the interface is "line 1line 2" (i.e. the '\n' gets trashed). I'd like to know if there's anything that will take the '\n' into account and span several lines.
Have a look at JTextArea. This is from the Java 1.4.2 API Specification and sounds exactly like what you're looking for:
A JTextArea is a multi-line area that displays plain text.
JOptionPane automatically parses the \n's to make multiple lines. It probably just uses multiple JLabels.
i agree with the JTextArea option..
if you set its border to null and call setEditable(false), setOpaque(false) then it will look like a JLabel
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL