Java Utililty Methods Swing UIManager

List of utility methods to do Swing UIManager

Description

The list of methods to do Swing UIManager are organized into topic(s).

Method

voidfixHtmlDisplay(JComponent component)
This method fixes the display of HTML enabled components (like JEditorPanes and JTextPanes).
Font defaultFont = UIManager.getFont("Button.font");
String stylesheet = "body { margin-top: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; font-family: "
        + defaultFont.getName() + "; font-size: " + defaultFont.getSize() + "pt;   }"
        + "a, p, li { margin-top: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; font-family: "
        + defaultFont.getName() + "; font-size: " + defaultFont.getSize() + "pt;   }";
try {
    HTMLDocument doc = null;
    if (component instanceof JEditorPane) {
...
longgetAnimationSpeed()
Returns the length of time GUI animations take, in milliseconds.
long speed = -1;
ClassLoader cl = (ClassLoader) UIManager.get("ClassLoader");
if (cl != null) {
    String managerClassName = LAFWIDGET_PKG + "animation.AnimationConfigurationManager";
    Class<?> managerClazz = Class.forName(managerClassName, true, cl);
    Method m = managerClazz.getMethod("getInstance");
    Object manager = m.invoke(null);
    m = managerClazz.getMethod("getTimelineDuration");
...
ClassLoadergetClassLoaderForResources()
get Class Loader For Resources
ClassLoader cl = (ClassLoader) UIManager.get("ClassLoader");
if (cl == null)
    cl = Thread.currentThread().getContextClassLoader();
return cl;
ClassLoadergetClassLoaderForResources()
Returns the class loader for loading the resource files.
ClassLoader cl = (ClassLoader) UIManager.get("ClassLoader");
if (cl == null)
    cl = Thread.currentThread().getContextClassLoader();
return cl;
ColorgetDark()
get Dark
return UIManager.getColor(TABLE_FOREGROUND_COLOR_KEY);
ColorgetDefaultActiveBackgroundColour()
get Default Active Background Colour
if (defaultActiveBackgroundColour == null) {
    if (!isWindowsLookAndFeel()) {
        Color color = UIManager.getColor("activeCaptionBorder");
        if (color == null) {
            color = UIManager.getColor("controlShadow");
        defaultActiveBackgroundColour = getBrighter(color, 0.85);
    } else {
...
SimpleAttributeSetgetDefaultAttributeSet()
get Default Attribute Set
SimpleAttributeSet attrSet = new SimpleAttributeSet();
Font f = UIManager.getFont("Label.font");
StyleConstants.setFontFamily(attrSet, f.getFamily());
StyleConstants.setFontSize(attrSet, f.getSize());
StyleConstants.setBold(attrSet, false);
StyleConstants.setItalic(attrSet, (f.getStyle() & Font.ITALIC) != 0);
return attrSet;
intgetDefaultFieldHeigth()
get Default Field Heigth
if (defaultFieldHeigth <= 0) {
    JTextField jtf = new JTextField();
    jtf.setText("1234567890"); 
    defaultFieldHeigth = jtf.getPreferredSize().height;
    if (UIManager.getLookAndFeel() != null && UIManager.getLookAndFeel().getClass().getName()
            .equals("com.sun.java.swing.plaf.gtk.GTKLookAndFeel")) { 
        defaultFieldHeigth -= 4;
    if (defaultFieldHeigth < 21) {
        defaultFieldHeigth = 21;
return defaultFieldHeigth;
ColorgetDefaultForeground()
Returns the default color for foreground in user's color scheme.
return UIManager.getColor("textText");
ColorgetDefaultInactiveBackgroundColour()
get Default Inactive Background Colour
if (defaultInactiveBackgroundColour == null) {
    defaultInactiveBackgroundColour = UIManager.getColor("control");
return defaultInactiveBackgroundColour;