title: Line Wrap not working inside of JList Cells
body: <p>I am using a JList to wrap some variable read-only text displayed to the user.  Each line of text is rendered in a list cell based on JTextArea, i.e. </p>
  
  <pre><code>public class InfoTextCellRenderer extends JTextArea implements ListCellRenderer
  </code></pre>
  
  <p>and this renderer is used by the list:</p>
  
  <pre><code>textList.setCellRenderer(new InfoTextCellRenderer());
  </code></pre>
  
  <p>The JList is embedded in a JScrollPane.</p>
  
  <p>I do all this because the typical usage pattern here is to use the arrow keys, not the mouse.  This allows the current cell to be highlighted, making it obvious to the user what is happening.  The previous implementation, using a single JTextArea, required the user to press down arrow multiple times until the invisible caret (invisible because it wasn't editable) reached the point where scrolling could occur (bottom or top of window).</p>
  
  <p>The problem is that even though the InfoTextCellRenderer turns line wrap and word wrap on, when the text is displayed the wrapping doesn't happen.</p>
  
  <pre><code>public class InfoTextCellRenderer extends JTextArea implements ListCellRenderer {
  
      public InfoTextCellRenderer() {
          this.setFocusable(false);
      }
  
      /* (non-Javadoc)
       * @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
       */
      @Override
      public Component getListCellRendererComponent(JList list, Object value,
              int index, boolean isSelected, boolean cellHasFocus) {
          if (isSelected) {
              setBackground(list.getSelectionBackground());
              setForeground(list.getSelectionForeground());
          } else {    
              setBackground(list.getBackground());
              setForeground(list.getForeground());
          }
          setEditable(false);
          setFont(list.getFont());
          this.setLineWrap(true);          
          this.setWrapStyleWord(true);
          setText(value == null ? "" : value.toString());
          return this;
      }
  
  }
  </code></pre>
  
  <p>What might be preventing the line wrapping from occurring?</p>