java Swing Table with wrapped rows

Posted on 2008-11-19
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?
Question by:mdoland
    LVL 86

    Expert Comment

    You need to use a component for the CellRenderer that supports wrapping, such as JTextPane, instead of the default renderer
    LVL 86

    Accepted Solution

    Make the change below with the code at this link
            public CustomRenderer() {
                    textArea = new JTextArea();
                    scrollPane = new JScrollPane(textArea);

    Open in new window

    LVL 86

    Expert Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    tenRun challenge 28 67
    zeroFront challenge 7 58
    wordsFront challenge 8 47
    wordcount challenge 11 47
    INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
    Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
    Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now