04 august 2005

Enhance JGoodies Looks on JTabbedPane

I'm using for a period JGoodies Looks for displaying a polished face of my applications and I did like the demo of Karsten Lentzsch -Metamorphosis- so I becomed interested in obtaining the same effect of JTabbedPane tab header. The setting
tabbedPane.putClientProperty(Options.EMBEDDED_TABS_KEY, Boolean.TRUE);
helps but is not enough as the result is
A closer look like this

is obtained if you overwrite PlasticTabbedPaneUI method for
protected void paintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) with using a derived Bold font
and
protected void paintTabBackground(Graphics g, int tabIndex, int x, int y, int w, int h, boolean isSelected) with a GradientPaint on tab's header width.

Niciun comentariu: