title: Details JPanel with variable length fields
body: <p>I'm trying to create a Panel which contains N rows and 2 columns, where the first column is a label with a variable length but within certain limits (it varies length according to Language), while the second column contains fields with possibly very long text.</p>
  
  <p>I've tried with GridBagLayout using NetBeans however the results are messy when scaling the panel or adding very long fields..
  below a screenshot of the JPanel to see what I mean:</p>
  
  <p><img src="https://i.stack.imgur.com/ZFsFC.png" alt="enter image description here"></p>
  
  <p>I'd like the left column to be spaced from the left border, the first column to never resize to a smaller value than it's longest label (labels must always be readable), while the second column should visualize up to its available horizontal space and then show dots (and not crop the text).</p>
  
  <p>What's also boring is that although I defined NorthWest for orientation the Panel shows vertically aligned in the center</p>
  
  <p><strong>EDIT</strong>: I have used TableColumnAdjuster to use table rows instead of labels for my values so that I can select the values with the mouse.
  I still have the rows however fit the length of the text and not of the containing Panel:</p>
  
  <pre><code>public class TestPanel extends JPanel
  {
      private static ArrayList&lt;String&gt; columnNames = new ArrayList&lt;&gt;();
      static JTable table;
      MyTableModel myTableModel = new MyTableModel();
  
      static class MyTableModel extends AbstractTableModel
      {
          private String[] columnNames =
          {
              "Name", "Value"
          };
          private Object[][] data =
          {
              { "Subject", "very very very very very very very very very very very very very very very very long subject"},
              { "Date", "" },
              { "Location", "" },
              { "Status", "" },
              { "Notes", "" }
          };
  
          @Override
          public int getColumnCount()
          { return columnNames.length; }
  
          @Override
          public int getRowCount()
          {  return data.length; }
  
          @Override
          public String getColumnName(int col)
          {  return columnNames[col]; }
  
          @Override
          public Object getValueAt(int row, int col)
          {  return data[row][col]; }
  
          @Override
          public Class getColumnClass(int c)
          { return getValueAt(0, c).getClass(); }
  
          @Override
          public boolean isCellEditable(int row, int col)
          { return false; }
  
          @Override
          public void setValueAt(Object value, int row, int col)
          {        }
      }
  
      public TestPanel()
      {
          table = new JTable(myTableModel);
          table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
          TableColumnAdjuster tca = new TableColumnAdjuster(table);
          tca.adjustColumns();
  
          JPanel panel = new JPanel(new GridBagLayout());
          panel.add(table);
          GridBagConstraints constraints = new GridBagConstraints();
          constraints.weighty = 1.0;
          constraints.fill = GridBagConstraints.VERTICAL;
          panel.add(Box.createGlue(), constraints);
          add(panel);
      }
  
      public static void main(String args[])
      {
          JFrame frame = new JFrame();
          frame.setContentPane(new TestPanel());
          frame.setSize(300, 800);
          frame.setVisible(true);
      }
  }
  </code></pre>
  
  <p>while TableColumnAdjuster is from <a href="http://www.camick.com/java/source/TableColumnAdjuster.java" rel="nofollow noreferrer">TableColumnAdjuster</a>.. what I get is still as below</p>
  
  <p><img src="https://i.stack.imgur.com/8GpA5.png" alt="enter image description here"></p>