public class GralButton extends GralWidget
Modifier and Type | Class and Description |
---|---|
class |
GralButton.GraphicImplAccess |
(package private) class |
GralButton.MouseActionButton
Inner class to implement the mouse actions called from the gral implementing layer.
|
static class |
GralButton.State
The state of switch and check button
1=on 2=off 3=disabled. 0=initial, see
#kOn etc. |
GralWidget.ActionChangeSelect, GralWidget.ConfigData, GralWidget.DynamicData, GralWidget.ImplAccess
GralWidgetBase.GralWidgComposite, GralWidgetBase.TimeOrderCreateImplWidget
GralWidget_ifc.ActionChange, GralWidget_ifc.ActionChangeWhen
Modifier and Type | Field and Description |
---|---|
protected boolean |
bThreeStateSwitch
True if the button has three states: on, off, disabled.
|
protected GralColor |
colorBackDisabled
Color of button.
|
protected GralColor |
colorBackOn
Color of button.
|
protected GralColor |
colorLineDisabled
Color of button.
|
protected GralColor |
colorLineOff
Color of button.
|
protected GralColor |
colorLineOn
Color of button.
|
protected GralImageBase |
imageDisabled |
protected GralImageBase |
imageOff |
protected GralImageBase |
imageOn |
protected boolean |
isPressed
Currently pressed, show it in graphic.
|
protected java.lang.String |
sButtonTextDisabled |
protected java.lang.String |
sButtonTextOff |
protected java.lang.String |
sButtonTextOn |
protected boolean |
shouldSwitched
True if it is a switch or a check button.
|
protected GralButton.State |
switchState |
static int |
version
Version, history and license.
|
protected boolean |
wasPressed
Used to one time query
|
protected boolean |
wasReleased
Used to one time query
|
protected boolean |
XXXpressed |
_wdgImpl, bEditable, bShouldInitialize, cfg, contextMenu, dateUser, dyda, htmlHelp, lastTimeSetVisible, redrawDelayMax, redrawtDelay, sCmd, sFormat, showWidgetInfo, sToolTip, sVersion, whatIs, XXXbuildMng
_cdata, _wdgPos, bVisibleState, gralMng, name, pixSize
Constructor and Description |
---|
GralButton(GralPos pos,
java.lang.String sName) |
GralButton(GralPos currPos,
java.lang.String sPosName,
java.lang.String sText,
GralUserAction action)
Creates a button
|
GralButton(java.lang.String position,
java.lang.String sName,
java.lang.String sText,
GralUserAction action)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
activate()
This is the same action like release the left mouse button.
|
GralButton.State |
getState() |
boolean |
isDisabled() |
boolean |
isOn() |
boolean |
isPressed()
Returns the state whether is currently pressed.
|
protected void |
setActivated(boolean value)
Show the button in an activated state.
|
void |
setBackColor(GralColor color,
int ix)
Implementing for
|
void |
setDisableColorText(GralColor color,
java.lang.String text)
Sets the disable text and color.
|
void |
setState(GralButton.State state)
Sets the state of the button
|
void |
setState(java.lang.Object val)
Sets the appearance of the button
val instance of GralColor, change the color appropriate to the current state.
|
void |
setSwitchMode(GralColor colorOff,
GralColor colorOn)
Declares the button to a switch button (switching on/off) with the given colors.
|
void |
setSwitchMode(GralColor colorOff,
GralColor colorOn,
GralColor colorDisabled)
Declares the button to a check button (switching on/off/disable) with the given texts.
|
void |
setSwitchMode(GralImageBase imageOff,
GralImageBase imageOn)
Declares the button to a switch button (switching on/off) with the given images.
|
void |
setSwitchMode(GralImageBase imageOff,
GralImageBase imageOn,
GralImageBase imageDisabled)
Declares the button to a check button (switching on/off/disable) with the given texts.
|
void |
setSwitchMode(java.lang.String sButtonTextOff,
java.lang.String sButtonTextOn)
Declares the button to a switch button (switching on/off) with the given texts.
|
void |
setSwitchMode(java.lang.String sButtonTextOff,
java.lang.String sButtonTextOn,
java.lang.String sDisabled)
Declares the button to a check button (switching on/off/disable) with the given texts.
|
void |
setText(java.lang.String sButtonText)
Sets the text of the button.
|
void |
setValue(int cmd,
int ident,
java.lang.Object visibleInfo,
java.lang.Object userData)
Sets the current value of the content of the widget in the given context.
|
boolean |
wasPressed()
Returns one time true after pressing, all next queries return false till next pressing.
|
boolean |
wasReleased()
Returns one time true after releasing the button, all next queries return false till next releasing.
|
void |
XXXsetDisabled(boolean value) |
clearShowParam, createImplWidget_Gthread, getActionChange, getActionChangeStrict, getActionDrag, getActionDrop, getActionFocused, getActionShow, getBackColor, getCfgElement, getCmd, getCmd, getContentIdent, getContentInfo, getContextMenu, getData, getDataIx, getDataPath, getDataPath, getFloatValue, getFocusedWidget, getFormat, getGralWidget, getHtmlHelp, getImplAccess, getImplWidget, getItsPanel, getLongValue, getName, getShowMethod, getShowParam, getsToolTip, getText, getValue, getVariable, getVariableFromContentInfo, isChanged, isEditable, isGraphicDisposed, isInFocus, isNotEditableOrShouldInitialize, isVisible, redraw, redraw, redraw, redraw1, redrawOnlyDynamics, refreshFromVariable, refreshFromVariable, removeImplWidget_Gthread, requestNewValueForVariable, setActionChange, setActionFocused, setActionMouse, setActionShow, setBackgroundColor, setBoundsPixel, setCfgElement, setCmd, setContentIdent, setContentInfo, setData, setDataIx, setDataPath, setDragEnable, setDropEnable, setEditable, setFocus, setFocus, setFocusedWidget, setForegroundColor, setFormat, setHtmlHelp, setLineColor, setLongValue, setMinMax, setPrimaryWidgetOfPanel, setText, setTextColor, setToolTip, setToPanel, setValue, setValue, setValue, setVariable, setVisible, specifyActionChange, specifyContextMenu, stop, toString, toString, XXXgetWidgetImplementation, XXXremoveWidgetImplementation, XXXrepaintGthread, XXXsetFocusGThread
checkImplWidgetCreation, createImplWidget, gralMng, hasFocus, pos, remove, resizePostPreparation, setFocused
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
gralMng, pos, setFocused
public static final int version
wasPressed()
and wasReleased()
is polling request.
GralWidget.setVisible(boolean)
setSwitchMode(GralColor, GralColor, GralColor)
with null as 3. color
sets to 2-times switch like setSwitchMode(GralColor, GralColor)
.
activate()
method which should be invoked on ENTER-key.
GralButton
uses the new concept of instantiation: It is not
the super class of the implementation class. But it provides GralButton.GraphicImplAccess
as the super class.
setState(State)
with an enum, not int, used for showing active/inactive
setBackColor(GralColor, int)
protected boolean XXXpressed
protected GralButton.State switchState
protected java.lang.String sButtonTextOff
protected java.lang.String sButtonTextOn
protected java.lang.String sButtonTextDisabled
protected GralImageBase imageOff
protected GralImageBase imageOn
protected GralImageBase imageDisabled
protected GralColor colorBackOn
protected GralColor colorBackDisabled
protected GralColor colorLineOff
protected GralColor colorLineOn
protected GralColor colorLineDisabled
protected boolean isPressed
protected boolean wasPressed
protected boolean wasReleased
protected boolean shouldSwitched
protected boolean bThreeStateSwitch
public GralButton(GralPos pos, java.lang.String sName)
public GralButton(GralPos currPos, java.lang.String sPosName, java.lang.String sText, GralUserAction action)
sPosName
- If given with "@pos = name" then it is a position with name, see GralWidget#GralWidget(String, char)
sText
- The button textaction
- The action on release mouse@Deprecated public GralButton(java.lang.String position, java.lang.String sName, java.lang.String sText, GralUserAction action)
public void setSwitchMode(java.lang.String sButtonTextOff, java.lang.String sButtonTextOn)
setSwitchMode(GralColor, GralColor)
.
See setSwitchMode(GralImageBase, GralImageBase)
.sButtonTextOff
- sButtonTextOn
- public void setSwitchMode(java.lang.String sButtonTextOff, java.lang.String sButtonTextOn, java.lang.String sDisabled)
setSwitchMode(GralColor, GralColor, GralColor)
.
See setSwitchMode(GralImageBase, GralImageBase, GralImageBase)
.sButtonTextOff
- sButtonTextOn
- sDisabled
- public void setSwitchMode(GralColor colorOff, GralColor colorOn)
setSwitchMode(String, String)
.
See setSwitchMode(GralImageBase, GralImageBase)
.colorOff
- colorOn
- public void setSwitchMode(GralColor colorOff, GralColor colorOn, GralColor colorDisabled)
setSwitchMode(String, String, String)
.
See setSwitchMode(GralImageBase, GralImageBase, GralImageBase)
.colorOff
- colorOn
- public void setSwitchMode(GralImageBase imageOff, GralImageBase imageOn)
setSwitchMode(String, String)
.imageOff
- imageOn
- public void setSwitchMode(GralImageBase imageOff, GralImageBase imageOn, GralImageBase imageDisabled)
setSwitchMode(String, String, String)
.imageOff
- imageOn
- public void setBackColor(GralColor color, int ix)
setBackColor
in interface GralWidget_ifc
setBackColor
in class GralWidget
ix=0:
- off-color ix=1: on-color, ix=2 or ix=-1: disable color.GralWidget.setBackColor(org.vishia.gral.ifc.GralColor, int)
public void setDisableColorText(GralColor color, java.lang.String text)
color
- text
- public void setText(java.lang.String sButtonText)
sButtonText
- protected void setActivated(boolean value)
public void activate()
GralWidget.specifyActionChange(String, GralUserAction, String[], org.vishia.gral.ifc.GralWidget_ifc.ActionChangeWhen...)
with GralWidget_ifc.ActionChangeWhen#onMouse1Up
public void setValue(int cmd, int ident, java.lang.Object visibleInfo, java.lang.Object userData)
GralWidget
setValue
in class GralWidget
cmd
- see GralMng_ifc#cmdSet
etc. It is possible to set the color etc.ident
- Any number to specify set, maybe 0public void XXXsetDisabled(boolean value)
public boolean isDisabled()
public boolean isOn()
public boolean isPressed()
public boolean wasPressed()
public boolean wasReleased()
public void setState(java.lang.Object val)
val
- public void setState(GralButton.State state)
state
- one of #kOn
, , .java.lang.IllegalArgumentException
- if the state is faulty.public GralButton.State getState()