public class PromptSupport
extends java.lang.Object
Modifier and Type | Class | Description |
---|---|---|
static class |
PromptSupport.FocusBehavior |
Constructor | Description |
---|---|
PromptSupport() |
Modifier and Type | Method | Description |
---|---|---|
static org.eclipse.swt.graphics.Color |
getBackground(org.eclipse.swt.widgets.Control control) |
Get the background color of the
control , when no text is
present. |
static PromptSupport.FocusBehavior |
getFocusBehavior(org.eclipse.swt.widgets.Control control) |
Get the
PromptSupport.FocusBehavior of control . |
static int |
getFontStyle(org.eclipse.swt.widgets.Control control) |
Returns the font style of the prompt text, which is a OR mix of
SWT.ITALIC, SWT.NONE or SWT.BOLD
|
static org.eclipse.swt.graphics.Color |
getForeground(org.eclipse.swt.widgets.Control control) |
Get the foreground color of the prompt text.
|
static java.lang.String |
getPrompt(org.eclipse.swt.widgets.Control control) |
Get the prompt text of
control . |
static void |
init(java.lang.String promptText,
org.eclipse.swt.graphics.Color promptForeground,
org.eclipse.swt.graphics.Color promptBackground,
org.eclipse.swt.widgets.Control control) |
Convenience method to set the
promptText and
promptTextColor on a Control . |
static void |
setBackground(org.eclipse.swt.graphics.Color color,
org.eclipse.swt.widgets.Control control) |
Sets the prompts background color on
control . |
static void |
setFocusBehavior(PromptSupport.FocusBehavior focusBehavior,
org.eclipse.swt.widgets.Control control) |
Sets the
PromptSupport.FocusBehavior on control , if it is the
focus owner. |
static void |
setFontStyle(int fontStyle,
org.eclipse.swt.widgets.Control control) |
Set the style of the prompt font, which is a OR mix of SWT.ITALIC,
SWT.NONE or SWT.BOLD
|
static void |
setForeground(org.eclipse.swt.graphics.Color color,
org.eclipse.swt.widgets.Control control) |
Sets the foreground color of the prompt on
control . |
static void |
setPrompt(java.lang.String promptText,
org.eclipse.swt.widgets.Control control) |
Sets the prompt text on
control |
public static void init(java.lang.String promptText, org.eclipse.swt.graphics.Color promptForeground, org.eclipse.swt.graphics.Color promptBackground, org.eclipse.swt.widgets.Control control)
Convenience method to set the promptText
and
promptTextColor
on a Control
.
promptText
- Prompt TextpromptForeground
- ForegroundpromptBackground
- Backgroundcontrol
- controljava.lang.IllegalArgumentException
- if the control is not a Text Box, a
Combo Box, a StyledText or a CCombopublic static org.eclipse.swt.graphics.Color getBackground(org.eclipse.swt.widgets.Control control)
control
, when no text is
present. If no color has been set, the control
background
color will be returned.textComponent
- public static void setBackground(org.eclipse.swt.graphics.Color color, org.eclipse.swt.widgets.Control control)
Sets the prompts background color on control
. This
background color will only be used when no text is present.
background
- control
- java.lang.IllegalArgumentException
- if the control is not a Text Box, a
Combo Box, a StyledText or a CCombopublic static PromptSupport.FocusBehavior getFocusBehavior(org.eclipse.swt.widgets.Control control)
PromptSupport.FocusBehavior
of control
.control
- PromptSupport.FocusBehavior
or PromptSupport.FocusBehavior.HIDE_PROMPT
if
none is setpublic static void setFocusBehavior(PromptSupport.FocusBehavior focusBehavior, org.eclipse.swt.widgets.Control control)
PromptSupport.FocusBehavior
on control
, if it is the
focus owner.focusBehavior
- control
- java.lang.IllegalArgumentException
- if the control is not a Text Box, a
Combo Box, a StyledText or a CCombopublic static int getFontStyle(org.eclipse.swt.widgets.Control control)
control
- public static void setFontStyle(int fontStyle, org.eclipse.swt.widgets.Control control)
Set the style of the prompt font, which is a OR mix of SWT.ITALIC, SWT.NONE or SWT.BOLD
fontStyle
- control
- java.lang.IllegalArgumentException
- if the control is not a Text Box, a
Combo Box, a StyledText or a CCombopublic static org.eclipse.swt.graphics.Color getForeground(org.eclipse.swt.widgets.Control control)
GREY
color will be returned.color
- GREY
if none is setpublic static void setForeground(org.eclipse.swt.graphics.Color color, org.eclipse.swt.widgets.Control control)
control
. This
color will be used when no text is present.promptTextColor
- textComponent
- java.lang.IllegalArgumentException
- if the control is not a Text Box, a
Combo Box, a StyledText or a CCombopublic static java.lang.String getPrompt(org.eclipse.swt.widgets.Control control)
control
.control
- public static void setPrompt(java.lang.String promptText, org.eclipse.swt.widgets.Control control)
Sets the prompt text on control
promptText
- textComponent
- java.lang.IllegalArgumentException
- if the control is not a Text Box, a
Combo Box, a StyledText or a CCombo