?
Solved

java Swing Table with wrapped rows

Posted on 2008-11-19
3
Medium Priority
?
281 Views
Last Modified: 2013-11-23
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
Comment
Question by:mdoland
  • 3
3 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 22998916
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
 
LVL 86

Accepted Solution

by:
CEHJ earned 2000 total points
ID: 22999150
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 23039990
:-)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month15 days, 14 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question