本文整理了Java中javafx.scene.control.Button.<init>()
方法的一些代码示例,展示了Button.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.<init>()
方法的具体详情如下:
包路径:javafx.scene.control.Button
类名称:Button
方法名:<init>
暂无
代码示例来源: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: jfoenixadmin/JFoenix
@Override
public void start(Stage stage) {
FlowPane main = new FlowPane();
main.setVgap(20);
main.setHgap(20);
main.getChildren().add(new Button("Java Button"));
JFXButton jfoenixButton = new JFXButton("JFoenix Button");
main.getChildren().add(jfoenixButton);
JFXButton button = new JFXButton("RAISED BUTTON");
button.getStyleClass().add("button-raised");
main.getChildren().add(button);
JFXButton button1 = new JFXButton("DISABLED");
button1.setDisable(true);
main.getChildren().add(button1);
StackPane pane = new StackPane();
pane.getChildren().add(main);
StackPane.setMargin(main, new Insets(100));
pane.setStyle("-fx-background-color:WHITE");
final Scene scene = new Scene(pane, 800, 200);
scene.getStylesheets().add(ButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
stage.setTitle("JFX Button Demo");
stage.setScene(scene);
stage.show();
}
代码示例来源: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
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
private Button populateButton(final ListView<String> listView) {
final Button button = new Button("Populate", FontAwesome.DATABASE.view());
代码示例来源:origin: speedment/speedment
final ProgressBar bar = new ProgressBar();
final Label message = new Label();
final Button cancel = new Button("Cancel", FontAwesome.TIMES.view());
代码示例来源: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: torakiki/pdfsam
public ClosePane(EventHandler<ActionEvent> handler) {
setAlignment(Pos.CENTER_RIGHT);
getStyleClass().addAll(Style.CONTAINER.css());
Button closeButton = new Button(DefaultI18nContext.getInstance().i18n("Close"));
closeButton.getStyleClass().addAll(Style.BUTTON.css());
closeButton.setTextAlignment(TextAlignment.CENTER);
closeButton.setOnAction(ofNullable(handler).orElse(defaultHandler));
getChildren().add(closeButton);
}
}
代码示例来源:origin: torakiki/pdfsam
OpenWithDialog initFor(InputPdfArgumentsLoadRequest event) {
this.messageTitle
.setText(DefaultI18nContext.getInstance().i18n("Select the task to perform on the following files"));
filesList
.setItems(FXCollections.observableArrayList(event.pdfs.stream().map(Path::toString).collect(toList())));
modules.forEach(m -> {
if (m.descriptor().hasInputType(event.requiredInputTyle())) {
Button current = new Button(m.descriptor().getName());
current.getStyleClass().addAll(Style.FOOTER_BUTTON.css());
Optional.ofNullable(m.graphic()).ifPresent(g -> {
g.setScaleX(0.7);
g.setScaleY(0.7);
current.setGraphic(g);
});
current.setOnAction((e) -> {
eventStudio().broadcast(new ClearModuleEvent(), m.id());
eventStudio().broadcast(activeteModule(m.id()));
hide();
PdfLoadRequestEvent loadEvent = new PdfLoadRequestEvent(m.id());
event.pdfs.stream().map(Path::toFile).map(PdfDocumentDescriptor::newDescriptorNoPassword)
.forEach(loadEvent::add);
eventStudio().broadcast(loadEvent, m.id());
});
buttons.getChildren().add(current);
}
});
return this;
}
代码示例来源: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;
}
代码示例来源:origin: torakiki/pdfsam
public HidingPane() {
Button closeButton = new Button(DefaultI18nContext.getInstance().i18n("Close"));
closeButton.getStyleClass().addAll(Style.BUTTON.css());
closeButton.setTextAlignment(TextAlignment.CENTER);
closeButton.setOnAction(e -> this.setVisible(false));
HBox bottom = new HBox(closeButton);
bottom.setAlignment(Pos.CENTER_RIGHT);
bottom.getStyleClass().addAll(Style.CONTAINER.css());
super.setBottom(bottom);
}
}
代码示例来源:origin: torakiki/pdfsam
public BrowsableField() {
HBox.setHgrow(textField, Priority.ALWAYS);
this.getStyleClass().add("browsable-field");
validableContainer = new HBox(textField);
validableContainer.getStyleClass().add("validable-container");
textField.getStyleClass().add("validable-container-field");
browseButton = new Button(DefaultI18nContext.getInstance().i18n("Browse"));
browseButton.getStyleClass().addAll(Style.BROWSE_BUTTON.css());
browseButton.prefHeightProperty().bind(validableContainer.heightProperty());
browseButton.setMaxHeight(USE_PREF_SIZE);
browseButton.setMinHeight(USE_PREF_SIZE);
HBox.setHgrow(validableContainer, Priority.ALWAYS);
textField.validProperty().addListener((o, oldValue, newValue) -> {
if (newValue == ValidationState.INVALID) {
validableContainer.getStyleClass().addAll(Style.INVALID.css());
} else {
validableContainer.getStyleClass().removeAll(Style.INVALID.css());
}
});
textField.focusedProperty().addListener(
(o, oldVal, newVal) -> validableContainer.pseudoClassStateChanged(SELECTED_PSEUDOCLASS_STATE, newVal));
getChildren().addAll(validableContainer, browseButton);
}
代码示例来源:origin: org.controlsfx/controlsfx
/**
* Takes the provided {@link Action} and returns a {@link Button} instance
* with all relevant properties bound to the properties of the Action.
*
* @param action The {@link Action} that the {@link Button} should bind to.
* @param textBehavior Defines {@link ActionTextBehavior}
* @return A {@link Button} that is bound to the state of the provided
* {@link Action}
*/
public static Button createButton(final Action action, final ActionTextBehavior textBehavior) {
return configure(new Button(), action, textBehavior);
}
代码示例来源:origin: org.controlsfx/controlsfx
/**
* Takes the provided {@link Action} and returns a {@link Button} instance
* with all relevant properties bound to the properties of the Action.
*
* @param action The {@link Action} that the {@link Button} should bind to.
* @return A {@link Button} that is bound to the state of the provided
* {@link Action}
*/
public static Button createButton(final Action action) {
return configure(new Button(), action, ActionTextBehavior.SHOW);
}
代码示例来源:origin: com.cedarsoft.commons/javafx
@Nonnull
public static Button button(@Nonnull String text, @Nonnull EventHandler<ActionEvent> onAction) {
Button button = new Button(text);
button.setOnAction(onAction);
return button;
}
代码示例来源:origin: torakiki/pdfsam
Label memory = new Label(DefaultI18nContext.getInstance().i18n("Max memory {0}",
FileUtils.byteCountToDisplaySize(Runtime.getRuntime().maxMemory())));
Button copyButton = new Button(DefaultI18nContext.getInstance().i18n("Copy to clipboard"));
FontAwesomeIconFactory.get().setIcon(copyButton, FontAwesomeIcon.COPY);
copyButton.getStyleClass().addAll(Style.BUTTON.css());
代码示例来源:origin: com.vektorsoft.demux.desktop/demux-desktop
/**
* Initialize buttons with custom option strings.
*
* @param dlgOptions dialog options
*/
private void initButtons(String[] dlgOptions){
buttons = new Button[dlgOptions.length];
for(int i = 0;i < dlgOptions.length;i++){
buttons[i] = new Button(resourceManager.getString(dlgOptions[i]));
buttons[i].setOnAction(new ButtonActionHandler(i));
}
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
private void initMaterialButton() {
materialNode = new Button();
IconUtils.setFontIcon("fa-plus-circle:70", materialNode);
materialNode.getStyleClass().add("button-material");
controller.getRootStructure().setMaterialNode(materialNode);
}
代码示例来源:origin: de.jensd/fontawesomefx-common
public Button createIconButton(GlyphIcons icon, String text, String iconSize, String fontSize, ContentDisplay contentDisplay) {
Text label = createIcon(icon, iconSize);
Button button = new Button(text);
button.setStyle("-fx-font-size: " + fontSize);
button.setGraphic(label);
button.setContentDisplay(contentDisplay);
return button;
}
代码示例来源:origin: PhoenicisOrg/phoenicis
public FailurePanel() {
this.getStyleClass().add("rightPane");
this.setSpacing(10);
this.failureNotification = new Label();
this.failureNotification.setTextAlignment(TextAlignment.CENTER);
this.failureReason = new Label();
this.failureReason.setTextAlignment(TextAlignment.CENTER);
this.retryButton = new Button(tr("Retry"));
this.retryButton.getStyleClass().addAll("retryButton", "refreshIcon");
this.getChildren().addAll(this.failureNotification, this.failureReason, this.retryButton);
}
内容来源于网络,如有侵权,请联系作者删除!