Package org.pushingpixels.lafwidget

# Interface LafWidget<T extends JComponent>

All Known Implementing Classes:
  `AutoScrollWidget`, `DesktopIconHoverPreviewWidget`, `EditContextMenuWidget`, `GhostAnimationWidget`, `LafWidgetAdapter`, `LockBorderWidget`, `MenuSearchWidget`, `PasswordStrengthCheckerWidget`, `ScrollPaneSelectorWidget`, `SelectAllOnFocusGainWidget`, `SelectOnEscapeWidget`, `TabHoverPreviewWidget`, `TabOverviewDialogWidget`, `TabPagerWidget`, `TreeDragAndDropWidget`

public interface LafWidget<T extends JComponent>
Interface for LAF widgets (behavioural traits).

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`AUTO_SCROLL`
Client property name for specifying that a scroll pane should have auto-scroll support invoked on middle-mouse button click.
`static final String`
`COMPONENT_PREVIEW_PAINTER`
Client property name for specifying the preview painter for a component.
`static final String`
`HAS_LOCK_ICON`
Client property name for specifying that the `LockBorderWidget` should put a lock icon.
`static final String`
`IGNORE_GLOBAL_LOCALE`
Client property name for specifying that the label lookup for custom widgets and sub-components installed by various UI delegates should ignore the global locale (as returned by `Locale.getDefault()` and use the component-specific locale (as returned by `Component.getLocale()` instead.
`static final String`
`PASSWORD_STRENGTH_CHECKER`
Client property name for specifying password strength checker for a password field.
`static final String`
`TABBED_PANE_PREVIEW_PAINTER`
Client property name for specifying the preview painter for tabbed pane.
`static final String`
`TEXT_EDIT_CONTEXT_MENU`
Client property name for specifying that the text component should have the edit context menu (with Cut / Copy / Paste / ...
`static final String`
`TEXT_FLIP_SELECT_ON_ESCAPE`
Client property name for specifying that the text component contents should flip selection on ESCAPE key press.
`static final String`
`TEXT_SELECT_ON_FOCUS`
Client property name for specifying that the text component contents should be selected on focus gain.
`static final String`
`TREE_AUTO_DND_SUPPORT`
Client property name for specifying that the tree component should have automatic drag and drop support.

## Method Summary

Modifier and Type
Method
Description
`void`
`installComponents()`
Installs components for the associated component.
`void`
`installDefaults()`
Installs default settings for the associated component.
`void`
`installListeners()`
Installs listeners for the associated component.
`void`
`installUI()`
Installs UI on the associated component.
`boolean`
`requiresCustomLafSupport()`
Returns indication whether `this` widget requires custom LAF support.
`void`
`setComponent(T jcomp)`
Associates a component with `this` widget.
`void`
`uninstallComponents()`
Uninstalls components for the associated component.
`void`
`uninstallDefaults()`
Uninstalls default settings for the associated component.
`void`
`uninstallListeners()`
Uninstalls listeners for the associated component.
`void`
`uninstallUI()`
Uninstalls UI on the associated component.

## Field Details

### HAS_LOCK_ICON

static final String HAS_LOCK_ICON

Client property name for specifying that the `LockBorderWidget` should put a lock icon. This property can be set either on a single component or globally on `UIManager`. The value in both cases should be either `Boolean.TRUE` or `Boolean.FALSE`.

Since:
  3.2
See Also:
  - Constant Field Values

### TABBED_PANE_PREVIEW_PAINTER

static final String TABBED_PANE_PREVIEW_PAINTER

Client property name for specifying the preview painter for tabbed pane. This property can be set on a single tabbed pane. The value should be an instance of `TabPreviewPainter`. Default implementation of this `DefaultTabPreviewPainter`. Tabbed panes that have associated preview painters, have two widgets installed:

- Tab overview dialog from `TabOverviewDialogWidget`.
- Tab hover preview from `TabHoverPreviewWidget`.

Here is an example of tabbed pane with default tab preview painter installed:

`JTabbedPane jtp = new JTabbedPane();
jtp.putClientProperty(LafWidget.TABBED_PANE_PREVIEW_PAINTER,
new DefaultTabPreviewPainter());`

See Also:
  - Constant Field Values

### COMPONENT_PREVIEW_PAINTER

static final String COMPONENT_PREVIEW_PAINTER

Client property name for specifying the preview painter for a component. This property can be set either on a component or globally on `UIManager`. The value in both cases should be an instance of `PreviewPainter`. Default implementation is available in the `DefaultPreviewPainter`.

Here is an example of a scroll pane with default preview painter installed on the internal component:

`JPanel myPanel = new JPanel();
myPanel.putClientProperty(LafWidget.PANE_PREVIEW_PAINTER,
new DefaultPreviewPainter());
JScrollPane jsp = new JScrollPane(myPanel);`

See Also:
  - Constant Field Values

### PASSWORD_STRENGTH_CHECKER

static final String PASSWORD_STRENGTH_CHECKER

Client property name for specifying password strength checker for a password field. The value should be an instance of `PasswordStrengthChecker`, otherwise will be ignored. This property must be set on a specific `JPasswordField`. Here is an example:

`JPasswordField jpf = new JPasswordField("password", 10);
jpf.putClientProperty(LafWidget.PASSWORD_STRENGTH_CHECKER,
new PasswordStrengthChecker() {
public PasswordStrength getStrength(char[] password) {
if (password == null)
return PasswordStrength.WEAK;
int length = password.length;
if (length invalid input: '<' 3)
return PasswordStrength.WEAK;
if (length invalid input: '<' 6)
return PasswordStrength.MEDIUM;
return PasswordStrength.STRONG;
}
public String getDescription(PasswordStrength strength) {
if (strength == PasswordStrength.WEAK)
return "<html>This password is <b>way</b> too weak</html>";
if (strength == PasswordStrength.MEDIUM)
return "<html>Come on, you can do<br> a little better than that</html>";
if (strength == PasswordStrength.STRONG)
return "OK";
return null;
}
});`

See Also:
  - Constant Field Values

### TEXT_SELECT_ON_FOCUS

static final String TEXT_SELECT_ON_FOCUS

Client property name for specifying that the text component contents should be selected on focus gain. This property can be set either on a single text component or globally on `UIManager`. The value in both cases should be either `Boolean.TRUE` or `Boolean.FALSE`.

Here is an example of globally set property (all text components that don't specify `Boolean.FALSE` as a client property will have the "select all on focus gain" behaviour):

`UIManager.put(LafWidget.TEXT_SELECT_ON_FOCUS, Boolean.TRUE);`

See Also:
  - Constant Field Values

### TEXT_FLIP_SELECT_ON_ESCAPE

static final String TEXT_FLIP_SELECT_ON_ESCAPE

Client property name for specifying that the text component contents should flip selection on ESCAPE key press. This property can be set on a single text component. The value should be either `Boolean.TRUE` or `Boolean.FALSE`.

Here is an example of this property set on this specific text field:

`myTextField.put(LafWidget.TEXT_FLIP_SELECT_ON_ESCAPE, Boolean.TRUE);`

See Also:
  - Constant Field Values

### TEXT_EDIT_CONTEXT_MENU

static final String TEXT_EDIT_CONTEXT_MENU

Client property name for specifying that the text component should have the edit context menu (with Cut / Copy / Paste / ... menu items). This property can be set either on a single text component or globally on `UIManager`. The value in both cases should be either `Boolean.TRUE` or `Boolean.FALSE`.

Here is an example of globally set property (all text components that don't specify `Boolean.FALSE` as a client property will have the the edit context menu):

`UIManager.put(LafWidget.TEXT_EDIT_CONTEXT_MENU, Boolean.TRUE);`

See Also:
  - Constant Field Values

### TREE_AUTO_DND_SUPPORT

static final String TREE_AUTO_DND_SUPPORT
Client property name for specifying that the tree component should have automatic drag and drop support. This property can be set either on a single tree or globally on `UIManager`. The value in both cases should be either `Boolean.TRUE` or `Boolean.FALSE`.
Here is an example of globally set property (all trees that don't specify `Boolean.FALSE` as a client property will have the automatic drag and drop support):
`UIManager.put(LafWidget.TREE_AUTO_DND_SUPPORT, Boolean.TRUE);`

See Also:
  - Constant Field Values

### AUTO_SCROLL

static final String AUTO_SCROLL

Client property name for specifying that a scroll pane should have auto-scroll support invoked on middle-mouse button click. This property can be installed on a single scroll pane or globally on `UIManager` , and the value should be either `Boolean.TRUE` or `Boolean.FALSE`.

Here is an example of a scroll bar that has auto-scroll installed.

`JScrollPane scrollPane = ...
scrollPane.putClientProperty(LafWidget.AUTO_SCROLL, Boolean.TRUE);`

Since:
  version 3.4
See Also:
  - Constant Field Values

### IGNORE_GLOBAL_LOCALE

static final String IGNORE_GLOBAL_LOCALE

Client property name for specifying that the label lookup for custom widgets and sub-components installed by various UI delegates should ignore the global locale (as returned by `Locale.getDefault()` and use the component-specific locale (as returned by `Component.getLocale()` instead. This property can be installed only on a single component, and the value should be either `Boolean.TRUE` or `Boolean.FALSE`.

Here is an example of menu bar that will be localized according to its own locale

`JMenuBar jmb = ...
jmb.putClientProperty(LafWidget.IGNORE_GLOBAL_LOCALE, Boolean.TRUE);`

Since:
  version 3.1
See Also:
  - Constant Field Values

## Method Details

### setComponent

void setComponent(T jcomp)
Associates a component with `this` widget.

Parameters:
  `jcomp` - Component.

### requiresCustomLafSupport

boolean requiresCustomLafSupport()
Returns indication whether `this` widget requires custom LAF support. Some widgets such as `TabOverviewDialogWidget` or `TabHoverPreviewWidget` require custom implementation based on the internals of the specific LAF. Relevant functions in the base `LafWidgetSupport` support throw `UnsupportedOperationException`.

Returns:
  `true` if `this` widget requires custom LAF support, `false` otherwise.

### installUI

void installUI()
Installs UI on the associated component.

### installDefaults

void installDefaults()
Installs default settings for the associated component.

### installListeners

void installListeners()
Installs listeners for the associated component.

### installComponents

void installComponents()
Installs components for the associated component.

### uninstallUI

void uninstallUI()
Uninstalls UI on the associated component.

### uninstallDefaults

void uninstallDefaults()
Uninstalls default settings for the associated component.

### uninstallListeners

void uninstallListeners()
Uninstalls listeners for the associated component.

### uninstallComponents

void uninstallComponents()
Uninstalls components for the associated component.