title: How to remove/set JTextArea border in JTable cell in Nimbus look and feel
body: <p>Edit: I have added a <a href="http://sscce.org" rel="nofollow noreferrer">SSCCE</a> code </p>
  
  <p>I have extended JTextArea in TableCellRenderer because I wanted to achieve the Multiline text wrapping <a href="https://stackoverflow.com/questions/16597431/how-to-implement-multiple-line-text-renderer-in-jtable">Mentioned in this SO question</a> and that is working fine. Now I have ran into weird problem with Nimbus look and feel. Nimbus is adding a border with every cell as shown in the below picture. <img src="https://i.stack.imgur.com/bhpsa.png" alt="enter image description here"></p>
  
  <p>My Class:</p>
  
  <pre><code>import java.awt.Component;
  import java.awt.Dimension;
  import java.awt.event.WindowAdapter;
  import java.awt.event.WindowEvent;
  import java.util.ArrayList;
  import java.util.List;
  
  import javax.swing.JFrame;
  import javax.swing.JScrollPane;
  import javax.swing.JTable;
  import javax.swing.JTextArea;
  import javax.swing.UIManager;
  import javax.swing.UIManager.LookAndFeelInfo;
  import javax.swing.border.EmptyBorder;
  import javax.swing.table.DefaultTableModel;
  import javax.swing.table.TableCellRenderer;
  import javax.swing.table.TableModel;
  import javax.swing.table.TableRowSorter;
  
  public class TestJTableMultiline extends JFrame {
    /**
       * 
       */
      private static final long serialVersionUID = 1L;
  
  public TestJTableMultiline() {
      super("Multi-Line Cell Example");
      setDefaultCloseOperation(DISPOSE_ON_CLOSE);
      DefaultTableModel dm = new DefaultTableModel() {
        /**
           * 
           */
          private static final long serialVersionUID = 1L;
      public Class&lt;String&gt; getColumnClass(int columnIndex) {
          return String.class;
        }
        public boolean isCellEditable(int row, int column) {
          return false;
        }
      };
      dm.setDataVector(
          new Object[][]{
              {"A0, Line1\nA0, Line2\nA0, Line3", 
               "B0, Line1\nB0, Line2", 
               "C0, Line1"}, 
              {"A1, Line1", 
               "B1, Line1\nB1, Line2", 
               "C1, Line1"},
              {"A2, Line1", 
               "B2, Line1", 
               "C2, Line1"}
              }, 
              new Object[] {"A", "B", "C"});
  
      JTable table = new JTable(dm);
      table.setDefaultRenderer(String.class, new MultiLineTableCellRenderer());
      TableRowSorter&lt;? extends TableModel&gt; sort = new TableRowSorter&lt;DefaultTableModel&gt;(dm);
      table.setRowSorter(sort);
      JScrollPane scroll = new JScrollPane(table);
      getContentPane().add(scroll);
      setLocationByPlatform(true);
      setSize(400, 430);
      setVisible(true);
    }
  
    public static void main(String[] args) {
        try{
              for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                  if ("Nimbus".equals(info.getName())) {
                      UIManager.setLookAndFeel(info.getClassName());
                      System.out.println("choosed nimbus");
                      break;
                  }
              }
              }catch(Exception e){
                  e.printStackTrace();
              }
      TestJTableMultiline frame = new TestJTableMultiline();   
      frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
          System.exit(0);
        }
      });
    }
  }
  
  class MultiLineTableCellRenderer extends JTextArea 
  implements TableCellRenderer {
  /**
   * 
   */
  private static final long serialVersionUID = 1L;
  private List&lt;List&lt;Integer&gt;&gt; rowColHeight = new ArrayList&lt;List&lt;Integer&gt;&gt;();
  
  public MultiLineTableCellRenderer() {
    setLineWrap(true);
    setWrapStyleWord(true);
    setOpaque(true);
  }
  
  @Override
  public Component getTableCellRendererComponent(
      JTable table, Object value, boolean isSelected, boolean hasFocus,
      int row, int column) {
    if (isSelected) {
      setForeground(table.getSelectionForeground());
      setBackground(table.getSelectionBackground());
    } else {
      setForeground(table.getForeground());
      setBackground(table.getBackground());
    }
    setFont(table.getFont());
    if (hasFocus) {
      setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
      if (table.isCellEditable(row, column)) {
        setForeground(UIManager.getColor("Table.focusCellForeground"));
        setBackground(UIManager.getColor("Table.focusCellBackground"));
      }
    } else {
      setBorder(new EmptyBorder(1, 2, 1, 2));
    }
    if (value != null) {
      setText(value.toString());
    } else {
      setText("");
    }
    adjustRowHeight(table, row, column);
    return this;
  }
  
  /**
   * Calculate the new preferred height for a given row, and sets the height on the table.
   */
  private void adjustRowHeight(JTable table, int row, int column) {
    //The trick to get this to work properly is to set the width of the column to the 
    //textarea. The reason for this is that getPreferredSize(), without a width tries 
    //to place all the text in one line. By setting the size with the with of the column, 
    //getPreferredSize() returnes the proper height which the row should have in
    //order to make room for the text.
    int cWidth = table.getTableHeader().getColumnModel().getColumn(column).getWidth();
    setSize(new Dimension(cWidth, 1000));
    int prefH = getPreferredSize().height;
    while (rowColHeight.size() &lt;= row) {
      rowColHeight.add(new ArrayList&lt;Integer&gt;(column));
    }
    List&lt;Integer&gt; colHeights = rowColHeight.get(row);
    while (colHeights.size() &lt;= column) {
      colHeights.add(0);
    }
    colHeights.set(column, prefH);
    int maxH = prefH;
    for (Integer colHeight : colHeights) {
      if (colHeight &gt; maxH) {
        maxH = colHeight;
      }
    }
    if (table.getRowHeight(row) != maxH) {
      table.setRowHeight(row, maxH);
    }
  }
  
  }
  </code></pre>
  
  <p><code>What has been tried:</code> </p>
  
  <ol>
  <li><p>I have tried <code>setBorder(null)</code> and <code>setBorder(BorderFactory.createLineBorder(Color.black))</code> and various other color like forground and background color of the table. </p></li>
  <li><p>Then I looked at <a href="https://stackoverflow.com/questions/12844337/nimbus-jtextarea-default-border">this SO</a> question and tried that solution as well but I am not able to resolve the border problem. I have also tried removing setBorder call altogether but the results are same.</p></li>
  <li><p>I have also tried removing the cell border in jtable mentioned in this <a href="https://stackoverflow.com/questions/3167112/remove-cells-border-in-a-jtable">SO</a> question</p></li>
  </ol>
  
  <p>How can I resolve this border problem with Nimbus look and feel. </p>
  
  <p>Note: I am getting nice view with other look and feel. </p>