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

voidmakeSplitpaneNice()
Optimizes the appeareance of the JSplitPane.
UIManager.put("SplitPane.dividerSize", new Integer(1));
UIManager.put("SplitPane.border ", new EmptyBorder(0, 0, 0, 0));
UIManager.put("SplitPaneDivider.border", new EmptyBorder(0, 0, 0, 0));
voidmakeToolbarNice()
Optimizes the appeareance of the JToolbar.
UIManager.put("ToolBar.border", getEtchedBottomBorder(2, 5));
booleannoAltBg()
Determine if an alternate background color has been specified in the look and feel or theme.
if (noAltBg == null) {
    noAltBg = (UIManager.getColor(KEY_ALTBG) == null) ? 
            Boolean.TRUE : Boolean.FALSE;
return noAltBg.booleanValue();
voidpaintFocus(Graphics2D g, Shape shape, int biggestStroke)
Paints 3 different strokes around a shape to indicate focus.
Color focusColor = getFocusRingColor();
Color[] focusArray = new Color[] {
        new Color(focusColor.getRed(), focusColor.getGreen(), focusColor.getBlue(), 255),
        new Color(focusColor.getRed(), focusColor.getGreen(), focusColor.getBlue(), 170),
        new Color(focusColor.getRed(), focusColor.getGreen(), focusColor.getBlue(), 110) };
g.setStroke(new BasicStroke(biggestStroke));
g.setColor(focusArray[2]);
g.draw(shape);
...
voidpaintFocus(Graphics2D g, Shape shape, int biggestStroke)
Paints 3 different strokes around a shape to indicate focus.
Color focusColor = getFocusRingColor();
Color[] focusArray = new Color[] {
        new Color(focusColor.getRed(), focusColor.getGreen(), focusColor.getBlue(), 255),
        new Color(focusColor.getRed(), focusColor.getGreen(), focusColor.getBlue(), 170),
        new Color(focusColor.getRed(), focusColor.getGreen(), focusColor.getBlue(), 110) };
g.setStroke(new BasicStroke(biggestStroke));
g.setColor(focusArray[2]);
g.draw(shape);
...
voidpaintFocus(Graphics2D g, Shape shape, int biggestStroke)
Paints 3 different strokes around a shape to indicate focus.
Color focusColor = getFocusRingColor();
Color[] focusArray = new Color[] {
        new Color(focusColor.getRed(), focusColor.getGreen(), focusColor.getBlue(), 255),
        new Color(focusColor.getRed(), focusColor.getGreen(), focusColor.getBlue(), 170),
        new Color(focusColor.getRed(), focusColor.getGreen(), focusColor.getBlue(), 110) };
g.setStroke(new BasicStroke(biggestStroke));
g.setColor(focusArray[2]);
g.draw(shape);
...
voidpaintUnderlying(Graphics g, JComponent c)
Paints the underlying components of this component, in the area that is covered by the component.
g.setColor(UIManager.getColor("Window.background"));
g.fillRect(0, 0, c.getWidth(), c.getHeight());
voidpaintXpTabHeader(int type, Graphics g, int x, int y, int width)
Paints XP style tab highlight on given coordinates and with given width.
Color capBorderC = getXpHeaderColor(type, false);
Color capFillC = getXpHeaderColor(type, true);
g.setColor(capBorderC);
g.drawLine(x + 2, y, x + width - 3, y);
g.drawLine(x + 2, y, x, y + 2);
g.drawLine(x + width - 3, y, x + width - 1, y + 2);
g.setColor(capFillC);
g.drawLine(x + 2, y + 1, x + width - 3, y + 1);
...
voidprepareGUI(final String appName)
Prepares the Swing GUI.
prepareLocale(appName.toUpperCase() + "_LANG");
prepareTheme(appName.toUpperCase() + "_THEME");
voidprepareTheme(final String overrideEnvVar)
Prepares the theme.
final String sysThemeStr = overrideEnvVar == null ? null : System.getenv().get(overrideEnvVar);
System.setProperty("apple.laf.useScreenMenuBar", "true");
if (sysThemeStr == null || Boolean.parseBoolean(sysThemeStr)) {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());