javax.swing.plaf.SeparatorUI Java Examples

The following examples show how to use javax.swing.plaf.SeparatorUI. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Separator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void setUI(SeparatorUI ui) {
    synchronized(this) {
        if (!separatorUIInitialized) {
            macOsXSeparatorUI = createCustomUI(this);
            separatorUIInitialized = true;
        }
    }

    if (macOsXSeparatorUI == null) {
        super.setUI(ui);
    } else {
        super.setUI(macOsXSeparatorUI);
        setForeground(UIManager.getColor(MAC_OS_X_SEPARATOR_COLOR_KEY));
    }
}
 
Example #2
Source File: Separator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static SeparatorUI createCustomUI(JComponent separator) {
    if (MAC_OS_X_SEPARATOR_UI_CLASS != null) {
        try {
            Method m = MAC_OS_X_SEPARATOR_UI_CLASS.getDeclaredMethod(
                       "createUI", JComponent.class); // NOI18N
            return (SeparatorUI)m.invoke(null, separator);
        } catch (Throwable e) {
            return null;
        }
    } else {
        return null;
    }
}
 
Example #3
Source File: Separator.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public void setUI(SeparatorUI ui) {
    synchronized(this) {
        if (!separatorUIInitialized) {
            macOsXSeparatorUI = createCustomUI(this);
            separatorUIInitialized = true;
        }
    }

    if (macOsXSeparatorUI == null) {
        super.setUI(ui);
    } else {
        super.setUI(macOsXSeparatorUI);
        setForeground(UIManager.getColor(MAC_OS_X_SEPARATOR_COLOR_KEY));
    }
}
 
Example #4
Source File: Separator.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private static SeparatorUI createCustomUI(JComponent separator) {
    if (MAC_OS_X_SEPARATOR_UI_CLASS != null) {
        try {
            Method m = MAC_OS_X_SEPARATOR_UI_CLASS.getDeclaredMethod(
                       "createUI", JComponent.class); // NOI18N
            return (SeparatorUI)m.invoke(null, separator);
        } catch (Throwable e) {
            return null;
        }
    } else {
        return null;
    }
}