:: JGOODIES Looks :: Professional Swing Look&Feels

:: Other Options ::

Narrow Button Margins

Sun's Java l&f and Sun's Windows l&f use wide button margins of 14 pixel on each side, where most native toolkits use small margins like 4 or 5 pixel. Wide margins make buttons with a short label ("OK") a bit wider, which makes it easier to hit the button with the mouse. But it leads to a poor appearance if you use long labels. Most style guides recommend to use a button minimum widths that is independent of the button label. For example the MS Windows Layout Specifications recommend to use a minimum width of 50 Dialog Units (dlu) for command buttons.

The JGoodies l&fs allow you to use narrow button margins. See the Narrow page in the (Simple) Looks Demo. Since the Looks 2.0 the default is to use narrow buttons. Using narrow margins may significantly change your panel layout, if your layout management doesn't care about minimum button sizes. To turn off the use of narrow buttons you can use one of:

   Options.setUseNarrowButtons(false);
   UIManager.put("jgoodies.useNarrowButtons", Boolean.FALSE);
   
   java -Djgoodies.useNarrowButtons=false ...

Popup Menu Drop Shadow

You can enable or disable drop shadows for popup menus. As of the Looks 2.0 this feature is enabled on modern Windows (98/ME/2000/2003/XP/Vista) and disabled otherwise.

Note that this feature may be inactive even though it is enabled. For example drop shadows are always inactive on the Mac OS X, because this platform already uses native drop shadows. See also Options#isPopupDropShadowActive().

   Options.setPopupDropShadowEnabled(true);
   
   UIManager.put("jgoodies.popupDropShadowEnabled", Boolean.TRUE);
Also, you can enable or disable this feature in the system properties. This will override the UIManager setting.
java -Djgoodies.popupDropShadowEnabled=true ...

ComboBox Popup Menu Width

By default a JComboBox's popup menu is as wide as the combo box. You can change the popup menu by setting a popup prototype display value using one of:
   aJComboBox.putClientProperty(
        Options.COMBO_POPUP_PROTOTYPE_DISPLAY_VALUE_KEY,
        "The longest text in the combo popup menu");
        
   aJComboBox.putClientProperty(     
        "ComboBox.popupPrototypeDisplayValue",
        "The longest text in the combo popup menu");

Default Icon Size

The JGoodies l&fs try to vertically align menu item labels. Therefore a default icon size is is used if no icon is set. You should set this default size using one of the following methods:
     
   Options.setDefaultIconSize(new Dimension(18, 18));

   UIManager.put(
      com.jgoodies.looks.Options.DEFAULT_ICON_SIZE_KEY, 
      new Dimension(18, 18));

Tabbed Panes without Content Border

You can set a hint to paint tabbed panes without content border:
   a JTabbedPane.putClientProperty(Options.NO_CONTENT_BORDER_KEY, Boolean.TRUE);

Tabbed Panes with Embbedded Tabs

You can set a hint to render tabbed pane tab in an embedded style:
   aJTabbedPane.putClientProperty(Options.EMBEDDED_TABS_KEY, Boolean.TRUE);

Tab Icons

You can disable tab icons in the JGoodies looks:
   Options.setTabIconsEnabled(false);

No Tree Lines

Since Looks 1.1 you can hide the lines in trees by setting a client property. The property key and values are a subset of the Metal lines style properties.
   aJTree.putClientProperty(Options.TREE_LINE_STYLE_KEY, 
                            Options.TREE_LINE_STYLE_NONE_VALUE);

No Icon in Menu

You can set a client property for JMenus to indicate that no item in this menu has an icon. You can see this effect in the File->New submenu and in the backward button popup-menu of this help viewer.
   aJMenu.putClientProperty(Options.NO_ICONS_KEY, Boolean.TRUE);

No Popup Menu Margin

By default the JGoodies L&fs popup menus have a non-empty margin. You can set an empty margin using:
   aJPopupMenu.putClientProperty(Options.NO_MARGIN_KEY, Boolean.TRUE);

Text Field Selection on Keyboard Focus Traversal

If users are more likely going to reenter the entire value in a text field, all text shall be selected on focus gain. If users are more likely to edit a text, the caret shall be placed at the end of the text. You can enable or disable this feature globally, and can override it per component. This feature is enabled by default. By default the JGoodies L&fs popup menus have a non-empty margin. You can set an empty margin using:
   // Globally turn of the text selection on keyboard focus gain
   Options.setSelectOnFocusGainEnabled(false); 
    
   // Turn select on focus gain on for an individual text field
   Options.setSelectOnFocusGainEnabled(aTextField, Boolean.TRUE);
   // Turn this feature on for a text field without linking to the Looks
   aTextField.putClientProperty("JGoodies.selectAllOnFocusGain", Boolean.TRUE);
   
   // Select from end to start on keyboard focus gain.
   // Useful if the lead text shall be visible on focus gain
   // in a short field that often has a quite long text.
   aTextField.putClientProperty(Options.INVERT_SELECTION_CLIENT_KEY, Boolean.TRUE);
   // or:
   aTextField.putClientProperty("JGoodies.invertSelection", Boolean.TRUE);
   
   // Set the caret to start on focus lost.
   // Useful if the lead text shall be visible after focus lost
   // in a short field that often has a quite long text.
   aTextField.putClientProperty(Options.SET_CARET_TO_START_ON_FOCUS_LOST_CLIENT_KEY, Boolean.TRUE);
   // or:
   aTextField.putClientProperty("JGoodies.setCaretToStartOnFocusLost", Boolean.TRUE);
(c) 2009 JGoodies