title: JTabbedPane in JPanel?
body: <p>I have a simple problem when I want to add tabs in my jpanel. The alignment of the tabs get horizontal instead of vertical, wich looks like crap =/.</p>
  
  <p>It looks like this: </p>
  
  <p><img src="https://i.stack.imgur.com/Zwl74.png" alt="enter image description here"></p>
  
  <p>If I discard the panel instead and add the tabbedPane directly to the frame, everything works fine.
  If you uncomment the three lines of code and remove the <code>getContentPane().add(jtp);</code> you can reproduce my probleme.</p>
  
  <p>working Code:</p>
  
  <pre><code>public class TabbedPane extends JFrame
  {
      public TabbedPane()
      {
          setTitle("Tabbed Pane");
          setSize(300, 300); // set size so the user can "see" it
          JTabbedPane jtp = new JTabbedPane();
  
          // JPanel panel = new JPanel();//uncomment all three lines
          // panel.add(jtp);
          // getContentPane().add(panel);
  
          getContentPane().add(jtp);//remove me
  
          JPanel jp1 = new JPanel();// This will create the first tab
          JPanel jp2 = new JPanel();// This will create the second tab
  
          JLabel label1 = new JLabel();
          label1.setText("This is Tab 1");
          jp1.add(label1);
  
          jtp.addTab("Tab1", jp1);
          jtp.addTab("Tab2", jp2);
  
          JButton test = new JButton("Press");
          jp2.add(test);
  
          setVisible(true); // otherwise you won't "see" it
      }
  
      public static void main(String[] args)
      {
          TabbedPane tab = new TabbedPane();
      }
  
  }
  </code></pre>
  
  <p>Thanks a lot!</p>