title: JTable grid lines disappear unexpectedly
body: <p>I have an S (very S) SCCE which illustrates the problem: there is a JTable and a JTree both contained in a JPanel with a BorderLayout.  Most of the grid lines in the JTable show, but not the one at the left, and not the one at the top.  Have tried experimenting with borders, with placing the JTable on its own dedicated JPanel, etc.  </p>
  
  <p>I have gleaned from the experts that it is a bad idea to call any of the setXXXSize methods, so have not resorted to setPreferredSize, for example.  In the SSCCE you can swap the tree and table positions round by uncommenting the "EAST" line)</p>
  
  <p>How do I make these obscured/missing gridlines reappear?</p>
  
  <p>(NB the idea is eventually for the table to grow/shrink dynamically with the JTree, so that there are always the same number of rows in the table and the tree...  hence the desire to contain both components on the same JPanel).</p>
  
  <p>SSCCE:</p>
  
  <pre><code>import java.awt.*;
  import java.lang.reflect.InvocationTargetException;
  import javax.swing.*;
  import javax.swing.border.LineBorder;
  
  
  public class TableGridProb {
      public static void main( String[] args ) throws InterruptedException, InvocationTargetException{
  
          EventQueue.invokeAndWait( new Runnable(){
  
              @Override
        public void run() {
            JFrame frame = new JFrame( "Table Grid Prob" );
            frame.setSize( 800, 300 );
            frame.setVisible( true );
            JSplitPane split_pane = new JSplitPane();
            JScrollPane split_jsp = new JScrollPane( split_pane );
            JPanel left_panel = new JPanel();
            left_panel.setLayout( new BorderLayout() );
            JTree jt = new JTree();
            jt.setRowHeight( 20 );
            left_panel.add( jt, BorderLayout.WEST );
  //        left_panel.add( jt, BorderLayout.EAST );
  
            JTable jtable = new JTable( 4, 1  );
  
  //        jtable.setBorder( new LineBorder( Color.green, 3 ));
  
            jtable.setRowHeight( 20 );
            left_panel.add( jtable, BorderLayout.CENTER );
            split_pane.setLeftComponent( left_panel );
            frame.getContentPane().add( split_jsp );
            split_pane.setDividerLocation( 0.5d );
  
        }
          });
      }
  }
  </code></pre>
  
  <p><strong><em>later</em></strong></p>
  
  <p>In answer to the suggestion that all I have to do is wrap this JTable in a JScrollPane... this doesn't appear to solve the problem, at least with the standard Java L&amp;F.  I have also tried various permutations of sitting the JTable on a JScrollPane on a JPanel, sitting the JTable on its own JPanel and giving the latter a LineBorder, etc.  The problem appears to be a bit trickier.  My chief suspects are Insets and the layout managers... but
  1) neither of the getInsets methods of the JTable is called in the course of this code however
  2) maybe a BorderLayout is not ideal.  I did try GridLayout and BoxLayout but, as I recall, neither of these solved the problem...</p>
  
  <p><strong><em>later</em></strong></p>
  
  <p>even simpler SSCCE which illustrates the prob (cannot see left-hand vertical gridline)</p>
  
  <pre><code>import java.awt.*;
  import java.lang.reflect.InvocationTargetException;
  import javax.swing.*;
  
  
  public class TableGridProb2 {
    public static void main( String[] args ) throws InterruptedException, InvocationTargetException{
      EventQueue.invokeLater( new Runnable(){
        @Override
        public void run() {
          JFrame frame = new JFrame( "Table Grid Prob2" );
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          JScrollPane sp = new JScrollPane( new JTable( 20, 5 ));
          frame.getContentPane().add( sp );
          frame.pack();
          frame.setVisible( true );
        }
      });
    }
  }
  </code></pre>
  
  <p><strong>* later (6 Sep) *</strong></p>
  
  <p>screenshots for the two SSCCEs:</p>
  
  <p><img src="https://i.stack.imgur.com/nDRuF.jpg" alt="Table Grid Prob"></p>
  
  <p><img src="https://i.stack.imgur.com/4Rqi3.jpg" alt="Table Grid Prob 2"></p>
  
  <p>hope you can see the problem: missing vertical left-hand gridline (and top gridline it appears) in both cases...</p>