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

ColorgetUnfocusedSelectionForeground()
Get the system-wide unfocused selection foreground color
if (unfocusedSelFg == null) {
    unfocusedSelFg = UIManager.getColor("nb.explorer.unfocusedSelFg"); 
    if (unfocusedSelFg == null) {
        unfocusedSelFg = UIManager.getColor("textText"); 
        if (unfocusedSelFg == null) {
            unfocusedSelFg = Color.BLACK;
return unfocusedSelFg;
ColorgetUnfocusedSelectionForeground()
Get the system-wide unfocused selection foreground color
if (unfocusedSelFg == null) {
    unfocusedSelFg = UIManager.getColor("nb.explorer.unfocusedSelFg"); 
    if (unfocusedSelFg == null) {
        unfocusedSelFg = UIManager.getColor("textText"); 
        if (unfocusedSelFg == null) {
            unfocusedSelFg = Color.BLACK;
return unfocusedSelFg;
StringgetWindowsVisualStyle()
Returns the name of the current Windows visual style.
String style = UIManager.getString("win.xpstyle.name");
if (style == null) {
    style = (String) Toolkit.getDefaultToolkit().getDesktopProperty("win.xpstyle.colorName");
return style;
intGUI_unit(double p_GUI_unit, java.awt.Component c)
Converts a distance measured in "GUI unit" to pixels.
return (int) Math.round(p_GUI_unit * getRowHeight(c));
voidinit()
init
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
try {
    UIManager.setLookAndFeel(new WindowsLookAndFeel());
} catch (Exception e) {
    e.printStackTrace();
voidinitComponentHeight(final Component... components)
init Component Height
if (components == null) {
    return;
for (final Component component : components) {
    if ((component instanceof JComboBox) || (component instanceof JButton)) {
        component.setPreferredSize(new Dimension(component.getPreferredSize().width, 22));
    } else if (component instanceof JTextField) {
        final String lf = UIManager.getLookAndFeel().getClass().getName();
...
voidinitGui()
init Gui
if (!guiInitialized) {
    try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
    guiInitialized = true;
voidinitialize()
initialize
try {
    UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    UIDefaults ui = UIManager.getLookAndFeelDefaults();
    ui.put("TextPane.background", new Color(240, 240, 250));
    ui.put("Panel.background", new Color(240, 240, 250));
} catch (Exception e) {
    e.printStackTrace();
voidinitLnF()
Initializes the Look and feel; uses Nimbus if possible
try {
    UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (Exception e) {
    try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e1) {
        e1.printStackTrace();
voidinitNimbusStyle()
init Nimbus Style
try {
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
            UIManager.setLookAndFeel(info.getClassName());
            break;
} catch (ClassNotFoundException e) {
...