DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 1 of 1
  1. #1
    Join Date
    May 2006
    Posts
    15

    Swing Problem : Wrap Multiple line in a Cell (JTable)

    Hello...
    I'm doing a swing app. The functions included are to print the Jtable...
    in Colum 3 i've applied wrapping word in a cell.. the problem is when i print the table, the border in column 3 which wrap the word will not be visible...y?how can i solve this problem...can see my code like below

    Code:
    MyCellRenderer cellRenderer = new MyCellRenderer();  
    TableColumn column = null;
      column = tblProgram.getColumn(ResourceBundle.getBundle("Program").getString("TBL_DESC"));
    //get data in column 3   
    column.setCellRenderer(cellRenderer);
    Code:
      public class MyCellRenderer extends JTextArea implements TableCellRenderer {
            public MyCellRenderer() {
              setLineWrap(true);
              setWrapStyleWord(true);
              setMargin(new Insets(0, 5, 0, 5));
           }
        
          public Component getTableCellRendererComponent(JTable table, Object
                  value, boolean isSelected, boolean hasFocus, int row, int column) {
        	  setText((String)value);
              setSize(table.getColumnModel().getColumn(column).getWidth(),
                      getPreferredSize().height);
              if (table.getRowHeight(row) != getPreferredSize().height) {
                      table.setRowHeight(row, getPreferredSize().height);
              }
              return this;
          }
       }
    ty in advance
    Last edited by payung81; 06-01-2006 at 11:09 PM.

Similar Threads

  1. JTable problem
    By satish in forum Java
    Replies: 1
    Last Post: 02-23-2002, 01:44 AM
  2. Swing Focus Problem
    By Kent in forum Java
    Replies: 0
    Last Post: 02-04-2002, 01:30 AM
  3. Problem with multiple users
    By drexan in forum Enterprise
    Replies: 1
    Last Post: 11-11-2001, 11:38 PM
  4. Problem during delete multiple mails
    By Franck F in forum Enterprise
    Replies: 0
    Last Post: 08-29-2001, 08:31 AM
  5. JTextPane refresh problem under jdk 1.1.8 swing 1.1.1
    By François Bélair in forum Java
    Replies: 0
    Last Post: 08-26-2000, 02:19 PM

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links