Showing posts with label swing. Show all posts
Showing posts with label swing. Show all posts

Wednesday, December 12, 2012

Height of tab (JTabbedPane) in MAC

Code: 
JTabbedPane paneItem = new JTabbedPane();
JLabel iconInTab = new JLabel(new ImageIcon("myImage.png"));
iconInTab.setPreferredSize(new Dimension(100,80)); 
paneItem.addTab(null,new JPanel());
paneItem.setTabComponentAt(0,iconInTab);
 
I've also try this using html but it did not work either:
paneItem.addTab("<html><p><p><p></html>",new ImageIcon("myImage.png"),new JPanel()) 

Solution:
paneItem.setUI(new BasicTabbedPaneUI());
Also with some features:
paneItem.setTabPlacement(JTabbedPane.TOP);
paneItem.setTabLayoutPolicy(JTabbedPane.WRAP_TAB_LAYOUT);
paneItem.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);