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

JTabbedPanegetNestedTabbedPane(int orient, int top, int left, int bottom, int right)
Make a JTabbedPane without some of its border
Insets oldInsets = UIManager.getInsets("TabbedPane.contentBorderInsets");
Insets insets = new Insets(top, left, bottom, right);
UIManager.put("TabbedPane.contentBorderInsets", insets);
JTabbedPane tabPane = new JTabbedPane(orient);
UIManager.put("TabbedPane.contentBorderInsets", oldInsets);
return tabPane;
StringgetNimbusClassName()
get Nimbus Class Name
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
    if ("Nimbus".equals(info.getName())) {
        return info.getClassName();
return null;
IntegergetPropertyMaxGutterIconWidth(final String propertyPrefix)
get Property Max Gutter Icon Width
return (Integer) UIManager.get(propertyPrefix + ".maxGutterIconWidth");
intgetRowHeight(java.awt.Component c)
Returns the row height (font height) of 'c' of the reference component if 'c' is null.
java.awt.Font f = (c != null) ? c.getFont() : null;
if (f == null)
    f = getRefComp().getFont();
if (f == null)
    f = javax.swing.UIManager.getFont("Label.font");
return (c != null ? c : getRefComp()).getFontMetrics(f).getHeight();
JPanelgetSeparator()
Builds a separator panel
JPanel sep = new JPanel() {
    private static final long serialVersionUID = 3543668010487797227L;
    public void paintComponent(Graphics g) {
        int half = getWidth() / 2;
        g.setColor(UIManager.getColor("controlShadow"));
        g.drawLine(half, 0, half, getHeight());
};
...
intgetStringWidth(final String aString)
Returns the string width for the default label font and string.
return getStringWidth(UIManager.getFont("Label.font"), aString);
intgetSystemDefaultModifier()
gives default modifier of the current OS.
if (!(UIManager.getLookAndFeel().getID().equals(METAL_LAF_ID))) {
    int mask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
    if (mask == Event.META_MASK) {
        return KeyEvent.VK_META;
    } else if (mask == Event.ALT_MASK) {
        return KeyEvent.VK_ALT;
return KeyEvent.VK_CONTROL;
IcongetTitleBarIcon()
Obtains the title bar icon configured for this SOLA application based on the LAF theme.
Icon result = UIManager.getIcon("solaTitleBarIcon");
if (result == null) {
    result = new ImageIcon();
return result;
ColorgetToolTipBackground()
Gets the sampleToolTip attribute of the TapUtils class
return (Color) UIManager.get("ToolTip.background");
ColorgetToolTipBackground()
Returns the default background color to use for tool tip windows.
Color c = UIManager.getColor("ToolTip.background");
boolean isNimbus = isNimbusLookAndFeel();
if (c == null || isNimbus) {
    c = UIManager.getColor("info"); 
    if (c == null || (isNimbus && isDerivedColor(c))) {
        c = SystemColor.info; 
if (c instanceof ColorUIResource) {
    c = new Color(c.getRGB());
return c;