title: Show table on button click
body: <p>Simply what I want to do is to show some data in <code>JTable</code> when user click a button and it works correctly, however something weird is happening.  When I click button at first time nothing happens but when I maximize frame, the table appears!</p>
  <h3><code>ActionListener</code></h3>
  <pre><code>b2.addActionListener(new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                  // TODO Auto-generated method stub
                  boolean state = external.isSelected();
                  DefaultTableModel model = new DefaultTableModel(ManhattanTable(values), Headers(values));
                     JTable table = new JTable(model);
                     table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                     container.add(new JScrollPane(table));
                     table.setVisible(false);
                  if(state) {
                      PrintStream out = null;
                      try {
                          out = new PrintStream(new FileOutputStream(&quot;output.txt&quot;));
                      } catch (FileNotFoundException e1) {
                          // TODO Auto-generated catch block
                          e1.printStackTrace();
                      }
                      System.setOut(out);
                      long start= System.currentTimeMillis();
                      Manhattan(values);
                      long end=System.currentTimeMillis();
                      out.println(&quot;time: &quot;+(end-start)+&quot; milliseconds&quot;);
                      out.println(&quot;Number of input data: &quot;+values.size());    
                  } else {
                       table.setVisible(true);
                  }           
              }
          }); 
  </code></pre>
  <p>Anyone knows, why this strange behaviour?</p>