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
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center