當前位置: 首頁>>代碼示例>>Java>>正文


Java ButtonBar類代碼示例

本文整理匯總了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();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:21,代碼來源:ModalDialog.java

示例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.");
            }
        }));
    }
}
 
開發者ID:orange-alliance,項目名稱:TOA-DataSync,代碼行數:26,代碼來源:RankingsController.java

示例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;
        }
    });
}
 
開發者ID:mbari-media-management,項目名稱:vars-annotation,代碼行數:24,代碼來源:SelectMediaDialog.java

示例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();
}
 
開發者ID:DeskChan,項目名稱:DeskChan,代碼行數:28,代碼來源:TemplateBox.java

示例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();
    });
}
 
開發者ID:yuriy-budiyev,項目名稱:population,代碼行數:19,代碼來源:PopulationApplication.java

示例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);
    }
}
 
開發者ID:daothanhduy305,項目名稱:MusicHub,代碼行數:24,代碼來源:SettingsController.java

示例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
    }

}
 
開發者ID:dainesch,項目名稱:HueSense,代碼行數:24,代碼來源:AboutPresenter.java

示例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();
}
 
開發者ID:AdrianBZG,項目名稱:IEMLS,代碼行數:36,代碼來源:PerceptionActionAgent.java

示例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;
}
 
開發者ID:badarshahzad,項目名稱:SEGP_Group10,代碼行數:24,代碼來源:AssignPAT.java

示例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;
    }
 
開發者ID:badarshahzad,項目名稱:SEGP_Group10,代碼行數:20,代碼來源:Studentsinformation.java

示例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();
}
 
開發者ID:se-passau,項目名稱:jdime,代碼行數:30,代碼來源:GUI.java

示例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;
  }
}
 
開發者ID:keeps,項目名稱:roda-in,代碼行數:29,代碼來源:RodaInApplication.java

示例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();
  }
}
 
開發者ID:keeps,項目名稱:roda-in,代碼行數:22,代碼來源:InspectionPane.java

示例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;
}
 
開發者ID:keeps,項目名稱:roda-in,代碼行數:23,代碼來源:SchemaPane.java


注:本文中的javafx.scene.control.ButtonBar類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。