title: Swing : change selected tab value
body: <p>I want to change the value of the selected tab but I don't know how!</p>
  
  <pre><code>private JTabbedPane tab = new JTabbedPane();
  </code></pre>
  
  <p>I used that to make the second tab active but it doesn't work : <code>tab.getSelectedIndex()= 2</code></p>
  
  <p>How to change selected tab value?</p>