• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 286
  • Last Modified:

java Swing Table with wrapped rows

I have a JTable with a couple of columns. What do I need to do to make it wrap the text if the columns isze is too short?
0
mdoland
Asked:
mdoland
  • 3
1 Solution
 
CEHJCommented:
You need to use a component for the CellRenderer that supports wrapping, such as JTextPane, instead of the default renderer

http://www.roseindia.net/java/example/java/swing/CustomCellRenderer.shtml
0
 
CEHJCommented:
Make the change below with the code at this link

http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=2&t=011448
        public CustomRenderer() {
                textArea = new JTextArea();
                textArea.setLineWrap(true);
                scrollPane = new JScrollPane(textArea);
        }

Open in new window

0
 
CEHJCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now