public interface LafWidget<T extends javax.swing.JComponent>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AUTO_SCROLL
Client property name for specifying that a scroll pane should have
auto-scroll support invoked on middle-mouse button click.
|
static java.lang.String |
COMPONENT_PREVIEW_PAINTER
Client property name for specifying the preview painter for a component.
|
static java.lang.String |
HAS_LOCK_ICON
Client property name for specifying that the
LockBorderWidget
should put a lock icon. |
static java.lang.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 java.lang.String |
PASSWORD_STRENGTH_CHECKER
Client property name for specifying password strength checker for a
password field.
|
static java.lang.String |
TABBED_PANE_PREVIEW_PAINTER
Client property name for specifying the preview painter for tabbed pane.
|
static java.lang.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 java.lang.String |
TEXT_FLIP_SELECT_ON_ESCAPE
Client property name for specifying that the text component contents
should flip selection on ESCAPE key press.
|
static java.lang.String |
TEXT_SELECT_ON_FOCUS
Client property name for specifying that the text component contents
should be selected on focus gain.
|
static java.lang.String |
TREE_AUTO_DND_SUPPORT
Client property name for specifying that the tree component should have
automatic drag and drop support.
|
Modifier and Type | Method and 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.
|
static final java.lang.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
.
static final java.lang.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:
TabOverviewDialogWidget
.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());
static final java.lang.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);
static final java.lang.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 < 3)
return PasswordStrength.WEAK;
if (length < 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;
}
});
static final java.lang.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);
static final java.lang.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);
static final java.lang.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);
static final java.lang.String TREE_AUTO_DND_SUPPORT
UIManager
. The value in both cases
should be either Boolean.TRUE
or Boolean.FALSE
.Boolean.FALSE
as a client property will have the automatic drag
and drop support):
UIManager.put(LafWidget.TREE_AUTO_DND_SUPPORT, Boolean.TRUE);
static final java.lang.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);
static final java.lang.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);
void setComponent(T jcomp)
this
widget.jcomp
- Component.boolean requiresCustomLafSupport()
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
.true
if this
widget requires custom LAF
support, false
otherwise.void installUI()
void installDefaults()
void installListeners()
void installComponents()
void uninstallUI()
void uninstallDefaults()
void uninstallListeners()
void uninstallComponents()