Here you can find the source of reapplyFontSize(JSlider slider)
Parameter | Description |
---|---|
slider | a parameter |
public static void reapplyFontSize(JSlider slider)
//package com.java2s; //License from project: Open Source License import java.awt.Component; import java.awt.Font; import java.util.Dictionary; import java.util.Enumeration; import javax.swing.JSlider; public class Main { /**//w ww .ja v a 2s .c o m * Apply the font size to the labels of a slider. This must be called after * the labels of a slider are changed. * * First set up the label hash table and add it to the slider. Then, after * the slider has been added to a parent window and had its UI assigned, * call this method to change the label sizes. * * http://nadeausoftware.com/node/93#Settingsliderlabelfontsizes * * @param slider */ public static void reapplyFontSize(JSlider slider) { Font font = slider.getFont(); Dictionary dict = slider.getLabelTable(); Enumeration keys = dict.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Component label = (Component) dict.get(key); label.setFont(font); label.setSize(label.getPreferredSize()); } } }