Here's a tabbed pane class with over-sized tabs (50 tall and 140 wide).
public class GiantTabbedPane extends JTabbedPane {
public GiantTabbedPane() {
setUI((GiantTabbedPaneUI)GiantTabbedPaneUI.createUI(this));
setFont(new java.awt.Font("Arial Unicode MS", 1, 18));
}static class GiantTabbedPaneUI extends BasicTabbedPaneUI {
public static ComponentUI createUI(JComponent c) {
return new GiantTabbedPaneUI();
}protected int calculateTabWidth(int tabPlacement,
int tabIndex,
FontMetrics metrics) {
return 140;
}protected int calculateTabHeight(int tabPlacement,
int tabIndex,
int fontHeight) {
return 50;
}
}
}
No comments:
Post a Comment