Example usage for javax.swing UIDefaults getUI

List of usage examples for javax.swing UIDefaults getUI

Introduction

In this page you can find the example usage for javax.swing UIDefaults getUI.

Prototype

public ComponentUI getUI(JComponent target) 

Source Link

Document

Creates an ComponentUI implementation for the specified component.

Usage

From source file:net.sf.nmedit.jtheme.JTContext.java

public <T extends JTComponent> T createComponentInstance(Class<T> clazz) throws JTException {
    T component;/*  www. j a v a  2 s .c om*/

    try {
        component = clazz.getConstructor(new Class<?>[] { JTContext.class }).newInstance(new Object[] { this });

        UIDefaults defaults = getUIDefaults();
        if (hasUIClass(component, defaults)) {
            component.setUI(defaults.getUI(component));
        }
    } catch (Throwable t) {
        JTException e = new JTException("could not create instance of " + clazz);
        e.initCause(t);
        throw e;
    }

    return component;
}

From source file:net.sf.nmedit.jtheme.JTContext.java

private void installUI(JTModuleContainer moduleContainer) {
    UIDefaults defaults = getUIDefaults();
    //if (hasUIClass(moduleContainer, defaults))
    {/*from w w w .  j a va2  s . co  m*/
        moduleContainer.setUI((JTModuleContainerUI) defaults.getUI(moduleContainer));
    }
}