Bold font in JTabbedpane in Nimbus L&F
Hello All,
I am new to work with L&F in java. I am using Nimbus L&F for my application.
My requirement is i want to bold some of the tab title based on come constraints.
So i tried to create my own paneUI extending from BasicTabbedPaneUI.
Here is my code:
Code Java:
private class customTabbedPaneUI extends BasicTabbedPaneUI{
private Font boldFont = null;
protected void installDefaults() {
super.installDefaults();
boldFont = tabPane.getFont().deriveFont(Font.BOLD);
}
protected void paintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected){
if (My condition){
super.paintText(g, tabPlacement, boldFont, metrics, tabIndex, title, textRect, isSelected);
}else{
super.paintText(g, tabPlacement, font, metrics, tabIndex, title, textRect, isSelected);
}
}
}
Its working fine. The problem is its not at all coming with the Nimbus L&F. I can guess bcz of i am setting my UI as my customized one ( setUI(new customTabbedPaneUI ()))
Can you pleas any one help me. I want to change only the font to Bold without changing my nimbus L&F.
Please help me guys.
-Arun S