- java.lang.Object
-
- com.gluonhq.charm.glisten.control.Dialog<ButtonType>
-
- com.gluonhq.charm.glisten.control.Alert
-
- All Implemented Interfaces:
EventTarget
public class Alert extends Dialog<ButtonType>
The Alert class provides a number of pre-built dialogs made to be used in a common set of use cases.
The type of Alert is set by passing in an
Alert.AlertType
instance. This will dictate which buttons are displayed as well as a graphic illustrating the intention of the dialog.All Alerts have an optional content text as well as an optional title, are modal and blocking. "Modal" means that the user is prevented from interacting with the rest of the application while the Alert is showing and "blocking" means the call to
Dialog.showAndWait()
blocks code execution until the Alert is closed, this means the developer can show the Alert and interact with the result right after the methodDialog.showAndWait()
returns, which typically simplifies the code.The Alert types are:
- CONFIRMATION
- ERROR
- WARNING
- INFORMATION
- NONE
Alert alert = new Alert(AlertType.CONFIRMATION, "Some question to accept or reject"); alert.showAndWait();
- Since:
- 2.0.0
- See Also:
Dialog
-
-
Property Summary
Properties Type Property Description ObjectProperty<Alert.AlertType>
alertType
The type of Alert, one of theAlert.AlertType
possible types
-
Constructor Summary
Constructors Constructor Description Alert(Alert.AlertType alertType)
Creates an empty Alert with the given type.Alert(Alert.AlertType type, String contentText)
Creates an Alert with the given type and content text
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectProperty<Alert.AlertType>
alertTypeProperty()
The type of Alert, one of theAlert.AlertType
possible typesAlert.AlertType
getAlertType()
Gets the value of the property alertType.void
setAlertType(Alert.AlertType value)
Sets the value of the property alertType.-
Methods inherited from class com.gluonhq.charm.glisten.control.Dialog
autoHideProperty, buildEventDispatchChain, contentProperty, contentTextProperty, getButtons, getContent, getContentText, getGraphic, getId, getOnCloseRequest, getOnHidden, getOnHiding, getOnShowing, getOnShown, getTitle, getTitleText, graphicProperty, hide, idProperty, isAutoHide, isFullscreen, isShowing, onCloseRequestProperty, onHiddenProperty, onHidingProperty, onShowingProperty, onShownProperty, setAutoHide, setContent, setContentText, setGraphic, setId, setOnCloseRequest, setOnHidden, setOnHiding, setOnShowing, setOnShown, setResult, setTitle, setTitleText, showAndWait, showingProperty, titleProperty, titleTextProperty
-
-
-
-
Property Detail
-
alertType
public final ObjectProperty<Alert.AlertType> alertTypeProperty
The type of Alert, one of theAlert.AlertType
possible types- See Also:
getAlertType()
,setAlertType(Alert.AlertType)
-
-
Constructor Detail
-
Alert
public Alert(Alert.AlertType alertType)
Creates an empty Alert with the given type.- Parameters:
alertType
- The type of alert
-
Alert
public Alert(Alert.AlertType type, String contentText)
Creates an Alert with the given type and content text- Parameters:
type
- the type of this AlertcontentText
- the text content of this Alert
-
-
Method Detail
-
alertTypeProperty
public final ObjectProperty<Alert.AlertType> alertTypeProperty()
The type of Alert, one of theAlert.AlertType
possible types- See Also:
getAlertType()
,setAlertType(Alert.AlertType)
-
getAlertType
public final Alert.AlertType getAlertType()
Gets the value of the property alertType.- Property description:
- The type of Alert, one of the
Alert.AlertType
possible types
-
setAlertType
public final void setAlertType(Alert.AlertType value)
Sets the value of the property alertType.- Property description:
- The type of Alert, one of the
Alert.AlertType
possible types
-
-