本文整理匯總了Java中javafx.scene.control.Alert.initStyle方法的典型用法代碼示例。如果您正苦於以下問題:Java Alert.initStyle方法的具體用法?Java Alert.initStyle怎麽用?Java Alert.initStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.control.Alert
的用法示例。
在下文中一共展示了Alert.initStyle方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAlert
import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static Alert getAlert(String header, String content, AlertType alertType, Modality modality, Window window,
StageStyle style) {
Alert alert = new Alert(alertType);
alert.setTitle(Values.MAIN_TITLE);
alert.setHeaderText(header);
alert.setContentText(content);
alert.initModality(modality);
alert.initOwner(window);
alert.initStyle(style);
return alert;
}
示例2: doQuestion
import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
* Makes a question to the user.
*
* @param text
* the text
* @return true, if successful
*/
public static boolean doQuestion(String text , Stage window) {
boolean[] questionAnswer = { false };
// Show Alert
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.initStyle(StageStyle.UTILITY);
alert.initOwner(window);
alert.setHeaderText("Question");
alert.setContentText(text);
alert.showAndWait().ifPresent(answer -> questionAnswer[0] = ( answer == ButtonType.OK ));
return questionAnswer[0];
}
示例3: show
import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
* Shows the alert
*/
public void show(){
dialog = new Alert(type);
dialog.setTitle("Alert");
dialog.setContentText(msg);
dialog.setResizable(false);
dialog.initStyle(style);
dialog.showAndWait();
}
示例4: showNonblock
import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
* Shows the alert, but it isn't always on top
*/
public void showNonblock(){
dialog = new Alert(type);
dialog.setTitle("Alert");
dialog.setContentText(msg);
dialog.setResizable(false);
dialog.initStyle(style);
dialog.show();
}
示例5: show
import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
* Shows the alert
*/
public void show(){
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.initStyle(style);
alert.setContentText(warning);
alert.setHeaderText(header);
alert.showAndWait();
}
示例6: showNonblock
import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
* Shows the alert but isn't always on top
*/
public void showNonblock(){
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.initStyle(style);
alert.setContentText(warning);
alert.setHeaderText(header);
alert.show();
}
示例7: show
import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
* Shows the alert
* @return <code>true</code> if "Yes" was pressed, else return false
*/
public boolean show(){
alert = new Alert(Alert.AlertType.CONFIRMATION, question, ButtonType.YES, ButtonType.NO);
alert.initStyle(style);
Optional<ButtonType> result = alert.showAndWait();
if (result.isPresent()) if (result.get() == ButtonType.YES) return true;
return false;
}
示例8: deleteMoment
import javafx.scene.control.Alert; //導入方法依賴的package包/類
public void deleteMoment(){
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Avertissement suppression");
alert.setHeaderText("Vous allez supprimer le moment et tous ses sous-moments");
alert.setContentText("Voulez-vous continuer ?");
alert.initStyle(StageStyle.UTILITY);
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK){
for (Node m : main.getGrid().getChildren()) {
int pos = main.getGrid().getChildren().indexOf(m);
MomentExpVBox mom = (MomentExpVBox)m;
LinkedList<Node> moments = new LinkedList<Node>();
if (mom.getMoment().equals(moment)) {
for (int i = 0; i < main.getGrid().getChildren().size(); i++) {;
moments.add(main.getGrid().getChildren().get(i));
}
moments.remove(pos);
main.getGrid().getChildren().clear();
for (int j = 0; j < moments.size(); j++) {
main.getGrid().add(moments.get(j), j, 0);
}
// if number of elements sup to 1 remove one row
if((main.getGrid().getColumnConstraints().size() > 1)){
main.getGrid().getColumnConstraints().remove(main.getGrid().getColumnConstraints().size()-1);
main.getCurrentDescription().setNumberCols(main.getCurrentDescription().getNumberCols()-1);
}
main.getCurrentDescription().getMoments().remove(mom.getMoment());
// Actualize the col of the model
for (int i = 0; i < main.getGrid().getChildren().size()-1; i++) {
main.getCurrentDescription().getMoments().get(i).setGridCol(i);
}
break;
}
else{
removeMomentFromParent(mom,main);
}
}
}
}