本文整理了Java中javafx.scene.control.Button.setOnAction()
方法的一些代码示例,展示了Button.setOnAction()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.setOnAction()
方法的具体详情如下:
包路径:javafx.scene.control.Button
类名称:Button
方法名:setOnAction
暂无
代码示例来源:origin: speedment/speedment
private Button addButton(final ListView<String> listView) {
final Button button = new Button("Add Item", FontAwesome.PLUS.view());
button.setOnAction(e -> {
final int newIndex = listView.getItems().size();
final Set<String> set = new HashSet<>(strings);
final AtomicInteger i = new AtomicInteger(0);
while (!set.add(DEFAULT_FIELD + i.incrementAndGet())) {}
listView.getItems().add(DEFAULT_FIELD + i.get());
listView.scrollTo(newIndex);
listView.getSelectionModel().select(newIndex);
// There is a strange behavior in JavaFX if you try to start editing
// a field on the same animation frame as another field lost focus.
// Therefore, we wait one animation cycle before setting the field
// into the editing state
runLater(() -> listView.edit(newIndex));
});
return button;
}
代码示例来源:origin: speedment/speedment
@Override
public void initialize(URL location, ResourceBundle resources) {
brand.logoLarge().map(Image::new).ifPresent(titleImage::setImage);
license.setText(license.getText().replace("{title}", infoComponent.getTitle()));
version.setText(infoComponent.getImplementationVersion());
external.setText(infoComponent.getLicenseName());
close.setOnAction(newCloseHandler());
}
}
代码示例来源:origin: pmd/pmd
stage.initModality(Modality.WINDOW_MODAL);
setClassPathButton.setOnAction(e -> {
stage.close();
onApply.accept(fileListView.getItems());
});
cancelButton.setOnAction(e -> stage.close());
代码示例来源:origin: jfoenixadmin/JFoenix
@Override
protected void afterShow(Stage stage) {
JFXDialogLayout layout = new JFXDialogLayout();
layout.setBody(new Label("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."));
JFXAlert<Void> alert = new JFXAlert<>(stage);
alert.setOverlayClose(true);
alert.setAnimation(JFXAlertAnimation.CENTER_ANIMATION);
alert.setContent(layout);
alert.initModality(Modality.NONE);
leftButton.setOnAction(action-> alert.showAndWait());
}
代码示例来源:origin: pmd/pmd
@Override
public void initialize(URL location, ResourceBundle resources) {
BooleanBinding noSelection = fileListView.getSelectionModel().selectedItemProperty().isNull();
removeFileButton.disableProperty().bind(noSelection);
moveItemUpButton.disableProperty().bind(noSelection.or(fileListView.getSelectionModel().selectedIndexProperty().isEqualTo(0)));
// we can't just map the val because we need an ObservableNumberValue
IntegerBinding lastIndexBinding = Bindings.createIntegerBinding(() -> fileListView.getItems().size() - 1,
Val.wrap(fileListView.itemsProperty()).flatMap(LiveList::sizeOf));
moveItemDownButton.disableProperty().bind(noSelection.or(fileListView.getSelectionModel().selectedIndexProperty().isEqualTo(lastIndexBinding)));
fileListView.setCellFactory(DesignerUtil.simpleListCellFactory(File::getName, File::getAbsolutePath));
selectFilesButton.setOnAction(e -> onSelectFileClicked());
removeFileButton.setOnAction(e -> onRemoveFileClicked());
moveItemUpButton.setOnAction(e -> moveUp());
moveItemDownButton.setOnAction(e -> moveDown());
}
代码示例来源:origin: speedment/speedment
@Override
public void initialize(URL location, ResourceBundle resources) {
title.setTextFill(Color.web("#45a6fc")); // TODO Use styleClass instead
header.setText("Component Explorer");
final RootItem root = new RootItem(speedment);
root.getChildren().addAll(components());
tree.setRoot(root);
close.setOnAction(newCloseHandler());
}
代码示例来源:origin: speedment/speedment
@Override
public Button createNode() {
final Button btn = new Button(text, icon.view());
btn.setTextAlignment(TextAlignment.CENTER);
btn.setAlignment(Pos.CENTER);
btn.setMnemonicParsing(false);
btn.setLayoutX(10);
btn.setLayoutY(10);
btn.setPadding(new Insets(8, 12, 8, 12));
btn.setOnAction(handler);
btn.setTooltip(new Tooltip(tooltip));
return btn;
}
}
代码示例来源:origin: speedment/speedment
fieldFileBtn.setOnAction(ev -> {
fileChooser.setTitle("Open Database File");
buttonConnect.setOnAction(ev -> {
final DbmsType type = dbmsType.get();
代码示例来源:origin: speedment/speedment
private Button removeButton(final ListView<String> listView) {
final Button button = new Button("Remove Selected", FontAwesome.TIMES.view());
button.setOnAction(e -> {
final int selectedIdx = listView.getSelectionModel().getSelectedIndex();
if (selectedIdx != -1 && listView.getItems().size() > 1) {
final int newSelectedIdx = (selectedIdx == listView.getItems().size() - 1) ? selectedIdx - 1
: selectedIdx;
listView.getItems().remove(selectedIdx);
listView.getSelectionModel().select(newSelectedIdx);
}
});
return button;
}
代码示例来源:origin: speedment/speedment
));
okey.setOnAction(ev -> {
loader.loadAndShow("Connect");
代码示例来源:origin: speedment/speedment
private Button populateButton(final ListView<String> listView) {
final Button button = new Button("Populate", FontAwesome.DATABASE.view());
button.setOnAction(e -> {
final Column col = column.getMappedColumn();
代码示例来源:origin: pmd/pmd
@Override
public void initialize(URL location, ResourceBundle resources) {
commitButton.setOnAction(e -> {
commitHandler.ifPresent(Runnable::run);
getStage().close();
this.free();
});
commitButton.disableProperty().bind(validationSupport.invalidProperty());
Platform.runLater(() -> {
typeId.bind(typeChoiceBox.getSelectionModel().selectedItemProperty());
typeChoiceBox.setConverter(DesignerUtil.stringConverter(PropertyTypeId::getStringId,
PropertyTypeId::lookupMnemonic));
typeChoiceBox.getItems().addAll(PropertyTypeId.typeIdsToConstants().values());
FXCollections.sort(typeChoiceBox.getItems());
});
Platform.runLater(this::registerBasicValidators);
typeIdProperty().values()
.filter(Objects::nonNull)
.subscribe(this::registerTypeDependentValidators);
}
代码示例来源:origin: pmd/pmd
button.disableProperty().bind(validation.invalidProperty());
button.setOnAction(f -> {
DesignerUtil.stackTraceToXPath(area.getText()).ifPresent(xpathExpressionArea::replaceText);
popup.close();
代码示例来源:origin: speedment/speedment
btnClose.setOnAction( (ev) -> closeWindow() );
btnProceed.setOnAction( (ev) -> closeWindowAndGenerate());
btnProceed.disableProperty().bind(hasErrors);
代码示例来源:origin: jfoenixadmin/JFoenix
button.setOnAction(action -> treeView.scrollTo(treeView.getRow(node)));
final StackPane container = new StackPane(button);
container.setPickOnBounds(false);
代码示例来源:origin: pmd/pmd
@Override
protected void beforeParentInit() {
xpathExpressionArea.setSyntaxHighlighter(new XPathSyntaxHighlighter());
initGenerateXPathFromStackTrace();
initialiseVersionSelection();
expressionTitledPane.titleProperty().bind(xpathVersionUIProperty.map(v -> "XPath Expression (" + v + ")"));
xpathResultListView.setCellFactory(v -> new XpathViolationListCell());
exportXpathToRuleButton.setOnAction(e -> showExportXPathToRuleWizard());
EventStreams.valuesOf(xpathResultListView.getSelectionModel().selectedItemProperty())
.conditionOn(xpathResultListView.focusedProperty())
.filter(Objects::nonNull)
.map(TextAwareNodeWrapper::getNode)
.subscribe(parent::onNodeItemSelected);
xpathExpressionArea.richChanges()
.filter(t -> !t.isIdentity())
.successionEnds(XPATH_REFRESH_DELAY)
// Reevaluate XPath anytime the expression or the XPath version changes
.or(xpathVersionProperty().changes())
.subscribe(tick -> parent.refreshXPathResults());
}
代码示例来源:origin: speedment/speedment
});
cancel.setOnAction(ev -> {
if (!task.cancel(true)) {
LOGGER.error("Failed to cancel task.");
代码示例来源:origin: torakiki/pdfsam
private Button buildButton(String text, boolean response) {
Button button = new Button(text);
button.getStyleClass().addAll(Style.BUTTON.css());
button.setOnAction(e -> {
this.response = response;
hide();
});
return button;
}
代码示例来源:origin: jfoenixadmin/JFoenix
closeButton.setOnAction(action->{
TabPaneBehavior behavior = getBehavior();
if (behavior.canCloseTab(tab)) {
代码示例来源:origin: torakiki/pdfsam
private HBox buildFooter() {
Button closeButton = new Button(DefaultI18nContext.getInstance().i18n("Close"));
closeButton.getStyleClass().addAll(Style.BUTTON.css());
closeButton.setTextAlignment(TextAlignment.CENTER);
closeButton.setOnAction(e -> eventStudio().broadcast(activeteCurrentModule()));
HBox footer = new HBox(closeButton);
footer.getStyleClass().addAll(Style.CLOSE_FOOTER.css());
return footer;
}
内容来源于网络,如有侵权,请联系作者删除!