JTable + multiline cell + align problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: JTable + multiline cell + align problem

Hybrid View

  1. #1
    Join Date
    Jul 2006
    Posts
    2

    JTable + multiline cell + align problem

    Hi all,

    Does anyone know how I could make a java table that has multiline text cells AND this multiline text is aligned to center? I tried to extend JTextArea and to implement TableRenderer - multiline was OK but it did not do anything on setHorizontalAlign. If I extend DefaultTableRender than I can align the text to center but I got no multiline...

    Any ideas?

    Thanks in advance.

    Somi

  2. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560

    A far fetched one perhaps...

    Have you tried using a JPanel extension where you override the paintComponent method and do the text drawing yourself, with FontMetrics for aligning the text strings properly in the xy plane.
    When a component class is used as a renderer, then most of the other functionality of that component class is unavailable. I tried it some years ago, and I was unable to fill a table column with "well behaved" scrollable textareas. That may have improved though...
    eschew obfuscation

  3. #3
    Join Date
    Jul 2006
    Posts
    2
    Quote Originally Posted by sjalle
    Have you tried using a JPanel extension where you override the paintComponent method and do the text drawing yourself, with FontMetrics for aligning the text strings properly in the xy plane.
    When a component class is used as a renderer, then most of the other functionality of that component class is unavailable. I tried it some years ago, and I was unable to fill a table column with "well behaved" scrollable textareas. That may have improved though...
    Hi sjalle,

    Thanks for the hint on the JPanel solution. I managed to do my fancy table with a day of hard work

Similar Threads

  1. Replies: 1
    Last Post: 05-07-2003, 07:01 PM
  2. Fixed Cell Height
    By Alice Claussen in forum Web
    Replies: 5
    Last Post: 10-05-2001, 02:49 PM
  3. Cell Phone Radiation - Hype?
    By John Hillman in forum Mobile
    Replies: 1
    Last Post: 10-31-2000, 02:35 AM
  4. cell color onclick
    By Mark Taylor in forum Architecture and Design
    Replies: 1
    Last Post: 10-25-2000, 08:21 PM
  5. cell color onclick
    By Mark Taylor in forum Web
    Replies: 0
    Last Post: 10-24-2000, 11:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center