0

As the title says, the height of my tabs is not increasing as it should, my code looks like this:

    JTabbedPane jtp = new JTabbedPane();
    JLabel iconInTab = new JLabel(new ImageIcon("myImage.png"));
    iconInTab.setPreferredSize(new Dimension(100,80)); // is the size of my Image, I've also try to do this using getSize
    jtp.addTab(null,new JPanel());
    jtp.setTabComponentAt(0,iconInTab);

I've also try this using html but it did not work either:

    jtp.addTab("<html><p><p><p></html>",new ImageIcon("myImage.png"),new JPanel());

with the first code the problem is not the change of the size horizontally (the width change correctly), the problem is only on the height, with the second code, if I add multiple lines inside the html code, the text appear incomplete (just show the middle line) (also the width behaves as expected, the problem is the height). . .

why is this happening? or how could I get this done?

Note: S.O.: Mac OS X 10.8.1

Ordiel
  • 2,442
  • 3
  • 36
  • 52

1 Answers1

0

Solved!!! The problem was that the default UI over MAC OS X (com.apple.laf.AquaTabbedPaneContrastUI), you only need to change it to the basicTabbedPaneUI (or the one of your preference), in my particular case I need to extend this class (it was a pain in the *, because what I wanted was really complex) to get the look & feel that I was expecting, if you have the same trouble just do this before adding your tabs:

     myTabbedPane.setUI(new BasicTabbedPaneUI());

Note: Checking the default UI of your TabbedPane, may solve many different problems.

Ordiel
  • 2,442
  • 3
  • 36
  • 52