akashsuresh
asked on
How to increase font size of labels in JPanel without using UpdateUI?
I want to increase the font of labels on a JPanel using a slider.Right now I am using UpdateUI each time the slider is moved to refresh the entire panel.However I lose all the changes done,for example if a label is clicked it changes to blue.When I move the slider,it resets everything to the start.How to avoid this?
can u post your code?
private static void applyLabelsFontSize(int fontSize) {
UIDefaults uiDefaults = UIManager.getDefaults();
Font font = uiDefaults.getFont("Label. font");
if (font != null) {
uiDefaults.put("Label.font ", new FontUIResource(font.derive Font(font. getStyle() , fontSize)));
}
SwingUtilities.updateCompo nentTreeUI (<the 'root' window of your app>);
}
UIDefaults uiDefaults = UIManager.getDefaults();
Font font = uiDefaults.getFont("Label.
if (font != null) {
uiDefaults.put("Label.font
}
SwingUtilities.updateCompo
}
ASKER
Ok now under a JFrame I have one panel and above that I have a Tabbed Pane.Now I want to increase the font of only the labels of the tabbedpane,how do I do that?
ASKER
I mean for example if I have a tabbedpane under the frame and I want to change the font size of the labels of only one panel,how do I do it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.