本文整理汇总了Java中javafx.scene.control.ButtonBar类的典型用法代码示例。如果您正苦于以下问题:Java ButtonBar类的具体用法?Java ButtonBar怎么用?Java ButtonBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ButtonBar类属于javafx.scene.control包,在下文中一共展示了ButtonBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getChildren
import javafx.scene.control.ButtonBar; //导入依赖的package包/类
private ObservableList<Node> getChildren(Node node) {
if (node instanceof ButtonBar) {
return ((ButtonBar) node).getButtons();
}
if (node instanceof ToolBar) {
return ((ToolBar) node).getItems();
}
if (node instanceof Pane) {
return ((Pane) node).getChildren();
}
if (node instanceof TabPane) {
ObservableList<Node> contents = FXCollections.observableArrayList();
ObservableList<Tab> tabs = ((TabPane) node).getTabs();
for (Tab tab : tabs) {
contents.add(tab.getContent());
}
return contents;
}
return FXCollections.observableArrayList();
}
示例2: deleteRankings
import javafx.scene.control.ButtonBar; //导入依赖的package包/类
public void deleteRankings() {
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.setTitle("Are you sure about this?");
alert.setHeaderText("This operation cannot be undone.");
alert.setContentText("You are about to purge team standings in TOA's databases for event " + Config.EVENT_ID + ". Rankings will become unavailable until you re-upload.");
ButtonType okayButton = new ButtonType("Purge Rankings");
ButtonType cancelButton = new ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE);
alert.getButtonTypes().setAll(okayButton, cancelButton);
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == okayButton) {
TOAEndpoint rankingEndpoint = new TOAEndpoint("DELETE", "upload/event/rankings");
rankingEndpoint.setCredentials(Config.EVENT_API_KEY, Config.EVENT_ID);
TOARequestBody requestBody = new TOARequestBody();
requestBody.setEventKey(Config.EVENT_ID);
rankingEndpoint.setBody(requestBody);
rankingEndpoint.execute(((response, success) -> {
if (success) {
TOALogger.log(Level.INFO, "Deleted rankings.");
}
}));
}
}
示例3: SelectMediaDialog
import javafx.scene.control.ButtonBar; //导入依赖的package包/类
@Inject
public SelectMediaDialog(AnnotationService annotationService,
MediaService mediaService,
ResourceBundle uiBundle) {
this.annotationService = annotationService;
this.mediaService = mediaService;
this.uiBundle = uiBundle;
VideoBrowserPaneController controller = new VideoBrowserPaneController(annotationService,
mediaService, uiBundle);
getDialogPane().setContent(controller.getRoot());
ButtonType ok = new ButtonType(uiBundle.getString("global.ok"), ButtonBar.ButtonData.OK_DONE);
ButtonType cancel = new ButtonType(uiBundle.getString("global.cancel"), ButtonBar.ButtonData.CANCEL_CLOSE);
getDialogPane().getButtonTypes().addAll(ok, cancel);
setResultConverter(buttonType -> {
if (buttonType == ok) {
return controller.getSelectedMedia().orElse(null);
}
else {
return null;
}
});
}
示例4: TemplateBox
import javafx.scene.control.ButtonBar; //导入依赖的package包/类
public TemplateBox(String name) {
setTitle(name);
initModality(Modality.NONE);
String style = LocalFont.getDefaultFontCSS();
getDialogPane().setStyle(
style
);
Stage stage = (Stage) getDialogPane().getScene().getWindow();
stage.setAlwaysOnTop(checkForceOnTop());
stage.getIcons().add(new Image(App.ICON_URL.toString()));
getDialogPane().getButtonTypes().add(new ButtonType(Main.getString("close"), ButtonBar.ButtonData.CANCEL_CLOSE));
openedDialogs.add(this);
final TemplateBox thisBox = this;
setOnCloseRequest(new EventHandler<DialogEvent>() {
@Override
public void handle(DialogEvent event) {
openedDialogs.remove(thisBox);
for(EventHandler<DialogEvent> handler : handlers){
handler.handle(event);
}
}
});
applyStyle();
}
示例5: showAlert
import javafx.scene.control.ButtonBar; //导入依赖的package包/类
public void showAlert(String title, String header, String content, Alert.AlertType type) {
Stage primaryStage = mPrimaryStage;
Platform.runLater(() -> {
Alert alert = new Alert(type);
alert.getDialogPane().getStylesheets()
.add("com/budiyev/population/resource/style/alert.css");
alert.setX(primaryStage.getX() + WINDOW_OFFSET);
alert.setY(primaryStage.getY() + WINDOW_OFFSET);
alert.initStyle(StageStyle.UTILITY);
alert.setTitle(title);
alert.setHeaderText(header);
alert.setContentText(content);
alert.getButtonTypes().clear();
alert.getButtonTypes().add(new ButtonType(getResources().getString("alert_close"),
ButtonBar.ButtonData.OK_DONE));
alert.showAndWait();
});
}
示例6: showRemovePathTileDialog
import javafx.scene.control.ButtonBar; //导入依赖的package包/类
/**
* Function name: showRemovePathTileDialog
* Usage: This method would remove the chosen pathTile from the grid and its relevant data from the back-end database
* @param pathTile pathTile to be removed
*/
private void showRemovePathTileDialog(PathTile pathTile) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
String headerMessage = "Remove this folder?";
alert.setTitle(headerMessage);
alert.setHeaderText(headerMessage);
alert.setContentText("If you remove the \"" + pathTile.getFolderNameStr() + "\" folder from Music, it won't" +
"appear in Music anymore, but won't be deleted.");
alert.initOwner(settingsWindow);
ButtonType buttonTypeConfirm = new ButtonType("Remove Folder", ButtonBar.ButtonData.APPLY);
ButtonType buttonTypeCancel = new ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE);
alert.getButtonTypes().setAll(buttonTypeConfirm, buttonTypeCancel);
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == buttonTypeConfirm){
removePathTile(pathTile, false);
}
}
示例7: initialize
import javafx.scene.control.ButtonBar; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
logoImg.setImage(UIUtils.getImage("logo.png"));
Dialog diag = new Dialog();
diag.getDialogPane().setContent(borderPane);
diag.getDialogPane().setBackground(Background.EMPTY);
diag.setResizable(true);
UIUtils.setIcon(diag);
ButtonType closeButton = new ButtonType("Close", ButtonBar.ButtonData.OK_DONE);
diag.getDialogPane().getButtonTypes().addAll(closeButton);
diag.setTitle("About HueSense");
Optional<ButtonType> opt = diag.showAndWait();
if (opt.isPresent() && opt.get().getButtonData() == ButtonBar.ButtonData.OK_DONE) {
// nothing
}
}
示例8: showOptions
import javafx.scene.control.ButtonBar; //导入依赖的package包/类
@Override
public void showOptions() {
Dialog<String> dialog = new Dialog<>();
dialog.setTitle("Perception-Action Configuration");
dialog.setHeaderText("You can define next action in function of agent perception (up, left, right and down)");
dialog.getDialogPane().setPrefSize(500, 600);
FontIcon icon = new FontIcon(FontAwesome.COGS);
icon.setIconSize(64);
dialog.setGraphic(icon);
ButtonType applyChanges = new ButtonType("Apply", ButtonBar.ButtonData.OK_DONE);
dialog.getDialogPane().getButtonTypes().addAll(applyChanges, ButtonType.CANCEL);
try {
FXMLLoader fxmlLoader = new FXMLLoader(ClassLoader.getSystemClassLoader().getResource("PerceptionActionAgent.fxml"));
Parent root = fxmlLoader.load();
dialog.getDialogPane().setContent(root);
dialog.setResultConverter(dialogButton -> {
if (dialogButton == applyChanges) {
PerceptionActionAgentController configurationController = fxmlLoader.getController();
for (PerceptionActionAgentController.PerceptionRule rule : configurationController.tableContent) {
((PerceptionAction) getAlgorithm()).addRule(rule.getLeft(), rule.getRight(), rule.getUp(), rule.getDown(), Directions.valueOf(rule.getAction()));
}
return null;
}
return null;
});
} catch (IOException e) {
new ErrorView("No possible load agent configuration");
e.printStackTrace();
}
Optional<String> s = dialog.showAndWait();
}
示例9: howToSaveDialog
import javafx.scene.control.ButtonBar; //导入依赖的package包/类
/**
* Shows a dialog, which prompts the user to choose how he wants to save the exercise.
* @return 0 == New catalog, 1 == Append a catalog, -1 == cancel or error.
*/
private int howToSaveDialog(){
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("What is your plan, master?");
alert.setHeaderText("Dobby is a free elf, and Dobby has come to save your exercise!");
((Stage)alert.getDialogPane().getScene().getWindow()).getIcons().add(new Image("file:pictures/icon.png"));
alert.setContentText("Do you want me to save the exercise to an existing catalog, or do you want to create a new one?");
ButtonType newCatalog = new ButtonType("Create a new catalog");
ButtonType appendCatalog = new ButtonType("Append an existing catalog");
ButtonType cancel = new ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE);
alert.getButtonTypes().setAll(newCatalog, appendCatalog, cancel);
Optional<ButtonType> result = alert.showAndWait();
if(result.isPresent()) {
if (result.get() == newCatalog) {
return 0;
} else if (result.get() == appendCatalog) {
return 1;
}
}
return -1;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-nimmdochirgendeinennamen,代码行数:27,代码来源:CatalogEditor.java
示例10: confirmMessage
import javafx.scene.control.ButtonBar; //导入依赖的package包/类
/**
* This method is called when there is a need of confirmation somewhere in
* the interface.
*/
public boolean confirmMessage(String message) {
ButtonType ok = new ButtonType("OK", ButtonBar.ButtonData.OK_DONE);
ButtonType cancel = new ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE);
Alert alert = new Alert(AlertType.WARNING, null, ok, cancel);
alert.setTitle("Warning");
alert.setHeaderText("Look, an Information Dialog");
alert.setContentText(message);
alert.showAndWait();
if (alert.getResult() != null) {
if (alert.getResult().getText().equalsIgnoreCase("ok")) {
return true;
}
}
return false;
}
示例11: confirmMessage
import javafx.scene.control.ButtonBar; //导入依赖的package包/类
public boolean confirmMessage(String message) {
ButtonType ok = new ButtonType("OK", ButtonBar.ButtonData.OK_DONE);
ButtonType cancel = new ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE);
Alert alert = new Alert(AlertType.WARNING, null, ok, cancel);
alert.setTitle("Warning");
alert.setHeaderText("Look, an Information Dialog");
alert.setContentText(message);
alert.showAndWait();
if (alert.getResult() != null) {
if (alert.getResult().getText().equalsIgnoreCase("ok")) {
return true;
}
}
return false;
}
示例12: showYesNoDialog
import javafx.scene.control.ButtonBar; //导入依赖的package包/类
/**
* Shows a blocking Yes/No/Cancel dialog and returns a <code>ButtonType</code> whose <code>ButtonData</code> is one
* of the corresponding enum values ({@link ButtonBar.ButtonData#YES}, {@link ButtonBar.ButtonData#NO},
* {@link ButtonBar.ButtonData#CANCEL_CLOSE}).
*
* @param content
* the content <code>String</code> for the <code>Alert</code>
* @param owner
* the owner <code>Window</code> for the dialog, may be null in which case the dialog will be non-modal
* @return the optional <code>ButtonType</code> returned from {@link Alert#showAndWait()}
*/
private Optional<ButtonType> showYesNoDialog(String content, Window owner) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
ButtonType yesType = new ButtonType("Yes", ButtonBar.ButtonData.YES);
ButtonType noType = new ButtonType("No", ButtonBar.ButtonData.NO);
ButtonType cancel = new ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE);
alert.setHeaderText(null);
alert.setContentText(content);
alert.getButtonTypes().setAll(yesType, noType, cancel);
if (owner != null) {
alert.initOwner(owner);
alert.initModality(Modality.WINDOW_MODAL);
}
return alert.showAndWait();
}
示例13: checkForUpdates
import javafx.scene.control.ButtonBar; //导入依赖的package包/类
/**
* @param checkForEnvVariable
* if true, the method will consult RODA-in env. variable to see if
* its running in a special mode (e.g. testing), in order to avoid
* checking for version update
*/
private static boolean checkForUpdates(boolean checkForEnvVariable) {
Optional<String> updateMessage = Controller.checkForUpdates(checkForEnvVariable);
if (updateMessage.isPresent()) {
Alert dlg = new Alert(Alert.AlertType.CONFIRMATION);
dlg.initStyle(StageStyle.UNDECORATED);
dlg.setHeaderText(I18n.t(Constants.I18N_MAIN_NEW_VERSION_HEADER));
dlg.setTitle("");
dlg.setContentText(updateMessage.get());
dlg.initModality(Modality.APPLICATION_MODAL);
dlg.initOwner(stage);
dlg.getDialogPane().setMinWidth(300);
dlg.showAndWait();
if (dlg.getResult().getButtonData() == ButtonBar.ButtonData.OK_DONE) {
OpenPathInExplorer.open(Constants.RODAIN_GITHUB_LATEST_VERSION_LINK);
}
return true;
} else {
return false;
}
}
示例14: removeMetadataAction
import javafx.scene.control.ButtonBar; //导入依赖的package包/类
private void removeMetadataAction() {
if (metadataCombo.getSelectionModel().getSelectedIndex() == -1)
return;
String remContent = I18n.t(Constants.I18N_INSPECTIONPANE_REMOVE_METADATA_CONTENT);
Alert dlg = new Alert(Alert.AlertType.CONFIRMATION);
dlg.initStyle(StageStyle.UNDECORATED);
dlg.setHeaderText(I18n.t(Constants.I18N_INSPECTIONPANE_REMOVE_METADATA_HEADER));
dlg.setTitle(I18n.t(Constants.I18N_INSPECTIONPANE_REMOVE_METADATA_TITLE));
dlg.setContentText(remContent);
dlg.initModality(Modality.APPLICATION_MODAL);
dlg.initOwner(stage);
dlg.showAndWait();
if (dlg.getResult().getButtonData() == ButtonBar.ButtonData.OK_DONE) {
DescriptiveMetadata toRemove = (DescriptiveMetadata) metadataCombo.getSelectionModel().getSelectedItem().getKey();
currentDescOb.getMetadata().remove(toRemove);
metadataCombo.getItems().remove(metadataCombo.getSelectionModel().getSelectedItem());
metadataCombo.getSelectionModel().selectFirst();
}
}
示例15: confirmUpdate
import javafx.scene.control.ButtonBar; //导入依赖的package包/类
private boolean confirmUpdate() {
if (rootNode.getChildren().isEmpty()) {
return true;
}
String content = I18n.t(Constants.I18N_SCHEMAPANE_CONFIRM_NEW_SCHEME_CONTENT);
Alert dlg = new Alert(Alert.AlertType.CONFIRMATION);
dlg.initStyle(StageStyle.UNDECORATED);
dlg.setHeaderText(I18n.t(Constants.I18N_SCHEMAPANE_CONFIRM_NEW_SCHEME_HEADER));
dlg.setTitle(I18n.t(Constants.I18N_SCHEMAPANE_CONFIRM_NEW_SCHEME_TITLE));
dlg.setContentText(content);
dlg.initModality(Modality.APPLICATION_MODAL);
dlg.initOwner(primaryStage);
dlg.showAndWait();
if (dlg.getResult().getButtonData() == ButtonBar.ButtonData.OK_DONE) {
rootNode.remove();
createRootNode();
treeView.setRoot(rootNode);
return true;
} else
return false;
}