• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to change tab size on Jtabbedpane?

 
dragon ji
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,guys,

I want to set an icon on each tab,so my code is as follows:



But the tab size is bigger than the img's size,How can I change it to the same as the image?

thanx a lot .

Best Regards

Dragon
 
Tommy Greenberg
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ImageIcon projectIcon= createImageIcon("bleumbuddy/workorder-tab2-active.gif");
/* Plus 2 to the width and height to make sure
* you have enough space for your icon. Fit it the best you can.
* It might work with plus 0. */
jPanel7.setSize((projectIcon.getWidth() + 2),(projectIcon.getHeight() + 2));

jTabbedPane1.addTab("",projectIcon,jPanel7);
 
dragon ji
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,Tommy Greenberg

I did that but it still doesn't work.

what shall I do?
 
Tommy Greenberg
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know, you might have to us the UI and paint the tab yourself.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!