Interface LafWidget<T extends JComponent>
- All Known Implementing Classes:
AutoScrollWidget
,DesktopIconHoverPreviewWidget
,EditContextMenuWidget
,GhostAnimationWidget
,LafWidgetAdapter
,LockBorderWidget
,MenuSearchWidget
,PasswordStrengthCheckerWidget
,ScrollPaneSelectorWidget
,SelectAllOnFocusGainWidget
,SelectOnEscapeWidget
,TabHoverPreviewWidget
,TabOverviewDialogWidget
,TabPagerWidget
,TreeDragAndDropWidget
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Client property name for specifying that a scroll pane should have auto-scroll support invoked on middle-mouse button click.static final String
Client property name for specifying the preview painter for a component.static final String
Client property name for specifying that theLockBorderWidget
should put a lock icon.static final String
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 byLocale.getDefault()
and use the component-specific locale (as returned byComponent.getLocale()
instead.static final String
Client property name for specifying password strength checker for a password field.static final String
Client property name for specifying the preview painter for tabbed pane.static final String
Client property name for specifying that the text component should have the edit context menu (with Cut / Copy / Paste / ...static final String
Client property name for specifying that the text component contents should flip selection on ESCAPE key press.static final String
Client property name for specifying that the text component contents should be selected on focus gain.static final String
Client property name for specifying that the tree component should have automatic drag and drop support. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Installs components for the associated component.void
Installs default settings for the associated component.void
Installs listeners for the associated component.void
Installs UI on the associated component.boolean
Returns indication whetherthis
widget requires custom LAF support.void
setComponent
(T jcomp) Associates a component withthis
widget.void
Uninstalls components for the associated component.void
Uninstalls default settings for the associated component.void
Uninstalls listeners for the associated component.void
Uninstalls UI on the associated component.
-
Field Details
-
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 onUIManager
. The value in both cases should be eitherBoolean.TRUE
orBoolean.FALSE
.- Since:
- 3.2
- See Also:
-
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 thisDefaultTabPreviewPainter
. 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:
- Tab overview dialog from
-
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 ofPreviewPainter
. Default implementation is available in theDefaultPreviewPainter
.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:
-
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 specificJPasswordField
. 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:
-
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 eitherBoolean.TRUE
orBoolean.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:
-
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
orBoolean.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:
-
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 eitherBoolean.TRUE
orBoolean.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:
-
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 onUIManager
. The value in both cases should be eitherBoolean.TRUE
orBoolean.FALSE
.
Here is an example of globally set property (all trees that don't specifyBoolean.FALSE
as a client property will have the automatic drag and drop support):
UIManager.put(LafWidget.TREE_AUTO_DND_SUPPORT, Boolean.TRUE);
- See Also:
-
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 eitherBoolean.TRUE
orBoolean.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:
-
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 byComponent.getLocale()
instead. This property can be installed only on a single component, and the value should be eitherBoolean.TRUE
orBoolean.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:
-
-
Method Details
-
setComponent
Associates a component withthis
widget.- Parameters:
jcomp
- Component.
-
requiresCustomLafSupport
boolean requiresCustomLafSupport()Returns indication whetherthis
widget requires custom LAF support. Some widgets such asTabOverviewDialogWidget
orTabHoverPreviewWidget
require custom implementation based on the internals of the specific LAF. Relevant functions in the baseLafWidgetSupport
support throwUnsupportedOperationException
.- Returns:
true
ifthis
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.
-