有没有办法设置JtabbedPane的tab(选项卡)的高度和宽度?
如题.
------解决方案--------------------可以, 自己写一个 YourPaneUI extends BasicTabbedPaneUI
下面2个方法就是画tab的高度和宽度
protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics)
protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)
比方说
protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics) {
return super.calculateTabWidth(tabPlacement, tabIndex, metrics)+80;
}
protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)
{
return super.calculateTabHeight(tabPlacement, tabIndex, fontHeight)+80;
}
就画出了大的tab
然后
JTabbedPane yourTabPane = new JTabbedPane();
YourPaneUI yourPaneUI = new YourPaneUI();
youtTabPane.setUI(yourPaneUI);
就行了