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

voidadjustBackground(JComponent c)
Change background of given component to light gray on Mac look and feel when the component is in a tabbed container and its background hasn't been already changed (is instance of UIResource).
if (!isAquaLaF || useDefaultBackground) {
    return;
if (!isInTabbedContainer(c)) {
    return;
Color currentBackground = c.getBackground();
if (currentBackground instanceof UIResource) {
...
voidapplySizeVariant(JComponent c)
apply Size Variant
String p = (String) c.getClientProperty("JComponent.sizeVariant");
if (p == null) {
} else if (p.equals("regular")) {
    c.setFont(UIManager.getFont("SystemFont"));
} else if (p.equals("small")) {
    c.setFont(UIManager.getFont("SmallSystemFont"));
} else if (p.equals("mini")) {
    c.setFont(UIManager.getFont("MiniSystemFont"));
...
voidbeep(Component comp)
beep
UIManager.getLookAndFeel().provideErrorFeedback(comp);
booleancanChangeSize()
can Change Size
return UIManager.getLookAndFeelDefaults().get("defaultFont") != null;
voidclearErrorLabel(JLabel label)
clear Error Label
label.setIcon(null);
label.setForeground(UIManager.getColor("Label.foreground"));
voidconfigureStandardUI()
Sets up the standard UI.
System.setProperty("apple.laf.useScreenMenuBar", Boolean.TRUE.toString()); 
try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception ex) {
    ex.printStackTrace(System.err);
intcreateDefaultHorizontalAlignment()
create Default Horizontal Alignment
int swingAlign = SwingConstants.RIGHT;
String defaultAlignment = UIManager.getDefaults().getString("Label.defaultHorizontalAlignment");
if (defaultAlignment != null) {
    if ("LEFT".equalsIgnoreCase(defaultAlignment)) {
        swingAlign = SwingConstants.LEFT;
    } else if ("RIGHT".equalsIgnoreCase(defaultAlignment)) {
        swingAlign = SwingConstants.RIGHT;
    } else if ("CENTER".equalsIgnoreCase(defaultAlignment)) {
...
JLabelcreateErrorLabel(String errorMsg)
create Error Label
JLabel label = new JLabel("<html><font color=red>" + errorMsg + "</font></html>");
label.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
return label;
JPanelcreateFlow(final Object... components)
create Flow
return createFlow(FlowLayout.LEFT, 0, components);
intcreateHorizontalAlignment(int scoutAlign)
create Horizontal Alignment
switch (scoutAlign) {
case -1: {
    return SwingConstants.LEFT;
case 0: {
    return SwingConstants.CENTER;
case 1: {
...