Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.jgoodies.forms.factories
Interface ComponentFactory

All Known Implementing Classes:
  DefaultComponentFactory

    public interface ComponentFactory

An interface that defines the factory methods as used by the `PanelBuilder` and its subclasses.

The String arguments passed to the methods `#createLabel(String)`, `#createTitle(String)`, and `#createSeparator(String, int)` can contain an optional mnemonic marker. The mnemonic and mnemonic index are indicated by a single ampersand (`&`). For example `"&Save"`, or `"Save &as"`. To use the ampersand itself duplicate it, for example `"Look&&Feel"`.

Version:
  $Revision: 1.2 $
Author:
  Karsten Lentzsch
See Also:
  `DefaultComponentFactory`, `PanelBuilder`

Method Summary
`JLabel` | `createLabel(String textWithMnemonic)` Creates and returns a label with an optional mnemonic.
`JComponent` | `createSeparator(String textWithMnemonic, int alignment)` Creates and returns a labeled separator.
`JLabel` | `createTitle(String textWithMnemonic)` Creates and returns a title label that uses the foreground color and font of a `TitledBorder`.

Method Detail

### createLabel

    JLabel createLabel(String textWithMnemonic)

  Creates and returns a label with an optional mnemonic.

       createLabel("Name");       // No mnemonic
       createLabel("N&ame");      // Mnemonic is 'a'
       createLabel("Save &as");   // Mnemonic is the second 'a'
       createLabel("Look&&Feel"); // No mnemonic, text is Look&Feel

  Parameters:
    `textWithMnemonic` - the label's text - may contain an ampersand (`&`) to mark a mnemonic
  Returns:
    an label with optional mnemonic

### createTitle

    JLabel createTitle(String textWithMnemonic)

  Creates and returns a title label that uses the foreground color and font of a `TitledBorder`.

       createTitle("Name");       // No mnemonic
       createTitle("N&ame");      // Mnemonic is 'a'
       createTitle("Save &as");   // Mnemonic is the second 'a'
       createTitle("Look&&Feel"); // No mnemonic, text is Look&Feel

  Parameters:
    `textWithMnemonic` - the label's text - may contain an ampersand (`&`) to mark a mnemonic
  Returns:
    an emphasized title label

### createSeparator

    JComponent createSeparator(String textWithMnemonic,
                               int alignment)

  Creates and returns a labeled separator. Useful to separate paragraphs in a panel, which is often a better choice than a `TitledBorder`.

       final int LEFT = SwingConstants.LEFT;
       createSeparator("Name",       LEFT); // No mnemonic
       createSeparator("N&ame",      LEFT); // Mnemonic is 'a'
       createSeparator("Save &as",   LEFT); // Mnemonic is the second 'a'
       createSeparator("Look&&Feel", LEFT); // No mnemonic, text is Look&Feel

  Parameters:
    `textWithMnemonic` - the label's text - may contain an ampersand (`&`) to mark a mnemonic
    `alignment` - text alignment, one of `SwingConstants.LEFT`, `SwingConstants.CENTER`, `SwingConstants.RIGHT`
  Returns:
    a title label with separator on the side

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2007 JGoodies Karsten Lentzsch. All Rights Reserved.