本文整理汇总了Java中com.jfoenix.controls.JFXButton.setOnAction方法的典型用法代码示例。如果您正苦于以下问题:Java JFXButton.setOnAction方法的具体用法?Java JFXButton.setOnAction怎么用?Java JFXButton.setOnAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jfoenix.controls.JFXButton
的用法示例。
在下文中一共展示了JFXButton.setOnAction方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showInfoDialog
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
public void showInfoDialog(){
JFXDialogLayout content = new JFXDialogLayout();
content.setHeading(new Text("Information"));
content.setBody(new Text("We are going to open your default browser window to let \n" +
"you choose the gmail account , allow the specified permissions\n" +
"and then close the window."));
JFXDialog dialog = new JFXDialog(myController, content, JFXDialog.DialogTransition.CENTER);
JFXButton button = new JFXButton("Okay");
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
dialog.close();
SplashWaitController.startBackgroundTasks();
myController.setScreen(AmailMain.splashWaitId);
}
});
content.setActions(button);
dialog.show();
}
示例2: show
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
public void show() {
textArea = new JFXTextArea(bodyText);
JFXDialogLayout content = new JFXDialogLayout();
content.setHeading(new Text(headingText));
content.setBody(textArea);
content.setPrefSize(dialogWidth, dialogHeight);
StackPane stackPane = new StackPane();
stackPane.autosize();
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
JFXButton button = new JFXButton("Okay");
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
dialog.close();
}
});
button.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
button.setPrefHeight(32);
button.setStyle(dialogBtnStyle);
content.setActions(button);
pane.getChildren().add(stackPane);
AnchorPane.setTopAnchor(stackPane, (pane.getHeight() - content.getPrefHeight()) / 2);
AnchorPane.setLeftAnchor(stackPane, (pane.getWidth() - content.getPrefWidth()) / 2);
dialog.show();
}
示例3: addFileChoosers
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public WizardStepBuilder addFileChoosers(final String fieldName, final String fileChooseLabel,
final String startDir, final FileChooser.ExtensionFilter... filters)
{
final WizardStep current = this.current;
final HBox box = new HBox();
final JFXButton button = new JFXButton(fileChooseLabel);
button.setStyle("-fx-text-fill: BLACK;-fx-font-size: 18px;-fx-opacity: 0.7;");
final FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(fileChooseLabel);
fileChooser.setInitialDirectory(new File(startDir));
fileChooser.getExtensionFilters().addAll(filters);
this.current.getData().put(fieldName, new SimpleSetProperty<File>());
button.setOnAction(e -> current.getData().get(fieldName)
.setValue(fileChooser.showOpenMultipleDialog(MineIDE.primaryStage)));
final Label label = new Label(fieldName);
GridPane.setHalignment(label, HPos.RIGHT);
GridPane.setHalignment(button, HPos.LEFT);
this.current.add(label, 0, this.current.getData().size() - 1);
final JFXTextField text = new JFXTextField();
text.setEditable(false);
((SimpleSetProperty<File>) this.current.getData().get(fieldName))
.addListener((SetChangeListener<File>) change ->
{
text.setText("");
change.getSet().forEach(file -> text.appendText(file.getAbsolutePath() + ", "));
text.setText(text.getText().substring(0, text.getText().length() - 2));
});
box.getChildren().addAll(text, button);
this.current.add(box, 1, this.current.getData().size() - 1);
return this;
}
示例4: show
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
public void show() {
JFXDialogLayout content = new JFXDialogLayout();
content.setHeading(new Text(headingText));
content.setBody(new Text(bodyText));
content.setPrefSize(dialogWidth, dialogHeight);
StackPane stackPane = new StackPane();
stackPane.autosize();
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
JFXButton button = new JFXButton("Okay");
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
dialog.close();
}
});
button.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
button.setPrefHeight(32);
button.setStyle(dialogBtnStyle);
content.setActions(button);
pane.getChildren().add(stackPane);
AnchorPane.setTopAnchor(stackPane, (pane.getHeight() - content.getPrefHeight()) / 2);
AnchorPane.setLeftAnchor(stackPane, (pane.getWidth() - content.getPrefWidth()) / 2);
dialog.show();
}
示例5: showDialog
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
public void showDialog() {
JFXDialogLayout jfxDialogLayout = new JFXDialogLayout();
jfxDialogLayout.setHeading(new Text(header));
jfxDialogLayout.setBody(new Text(content));
JFXDialog jfxDialog = new JFXDialog(stackPane, jfxDialogLayout, JFXDialog.DialogTransition.CENTER);
JFXButton okay = new JFXButton(buttonLabel);
okay.setPrefWidth(110);
okay.setStyle("-fx-background-color: #F39C12; -fx-text-fill: white;");
okay.setButtonType(JFXButton.ButtonType.RAISED);
okay.setOnAction(event -> {
jfxDialog.close();
stackPane.setVisible(false);
});
stackPane.setOnMouseClicked(event -> stackPane.setVisible(false));
jfxDialogLayout.setActions(okay);
jfxDialog.show();
}
示例6: createMainMenuButtton
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
private JFXButton createMainMenuButtton() {
// TODO find out why this does not work:
// RfxPrimaryButton mainMenuButton = new
// RfxPrimaryButton(FontAwesomeIconName.BARS);
// mainMenuButton.setOnAction(this::onMainMenuButton);
// return mainMenuButton;
JFXButton button = new JFXButton();
FontAwesomeIcon icon = new FontAwesomeIcon();
icon.setIcon(de.jensd.fx.glyphs.fontawesome.FontAwesomeIconName.BARS);
icon.setSize("17px");
String iconStyle = icon.getStyle() + ";" + new RfxStyleProperties()
.setFill(MaterialColorSetCssName.PRIMARY.FOREGROUND1()).toString();
icon.setStyle(iconStyle);
// RfxFontIcon icon=new RfxFontIcon(FontAwesomeIconName.BARS, 16,
// Color.WHITE);
button.setGraphic(icon);
button.setPadding(new Insets(8, 16, 8, 17));
// button.getStyleClass().add("button-flat");
button.setOnAction(this::onMainMenuButton);
return button;
}
示例7: addFileChooser
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public WizardStepBuilder addFileChooser(final String fieldName, final String fileChooseLabel, final String startDir,
final FileChooser.ExtensionFilter... filters)
{
final WizardStep current = this.current;
final HBox box = new HBox();
final JFXButton button = new JFXButton(fileChooseLabel);
button.setStyle("-fx-text-fill: BLACK;-fx-font-size: 18px;-fx-opacity: 0.7;");
final FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(fileChooseLabel);
fileChooser.setInitialDirectory(new File(startDir));
fileChooser.getExtensionFilters().addAll(filters);
this.current.getData().put(fieldName, new SimpleObjectProperty<File>());
button.setOnAction(
e -> current.getData().get(fieldName).setValue(fileChooser.showOpenDialog(MineIDE.primaryStage)));
final Label label = new Label(fieldName);
GridPane.setHalignment(label, HPos.RIGHT);
GridPane.setHalignment(button, HPos.LEFT);
this.current.add(label, 0, this.current.getData().size() - 1);
final JFXTextField text = new JFXTextField();
text.setEditable(false);
this.current.getData().get(fieldName).addListener(
(ChangeListener<File>) (observable, oldValue, newValue) -> text.setText(newValue.getAbsolutePath()));
box.getChildren().addAll(text, button);
this.current.add(box, 1, this.current.getData().size() - 1);
return this;
}
示例8: showDialogWithDirectory
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
public void showDialogWithDirectory() {
JFXDialogLayout jfxDialogLayout = new JFXDialogLayout();
jfxDialogLayout.setHeading(new Text("Candidates list created"));
jfxDialogLayout.setBody(new Text("Candidates list created, now you can open file at this directory [" + directoryLocation + "]"));
JFXDialog jfxDialog = new JFXDialog(stackPane, jfxDialogLayout, JFXDialog.DialogTransition.CENTER);
JFXButton okay = new JFXButton("Thanks");
JFXButton openDirectory = new JFXButton("Open directory");
okay.setPrefWidth(110);
okay.setStyle("-fx-background-color: #F39C12; -fx-text-fill: white;");
okay.setButtonType(JFXButton.ButtonType.RAISED);
okay.setOnAction(event -> {
jfxDialog.close();
stackPane.setVisible(false);
});
openDirectory.setPrefWidth(110);
openDirectory.setStyle("-fx-background-color: #00A65A; -fx-text-fill: white;");
openDirectory.setButtonType(JFXButton.ButtonType.RAISED);
openDirectory.setOnAction(event -> {
try {
Desktop.getDesktop().open(new File(directoryLocation));
} catch (IOException e) {
e.printStackTrace();
}
stackPane.setVisible(false);
});
stackPane.setOnMouseClicked(event -> stackPane.setVisible(false));
HBox hBox = new HBox(5);
hBox.getChildren().addAll(openDirectory, okay);
jfxDialogLayout.setActions(hBox);
jfxDialog.show();
}
示例9: createFlyout
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
/**
* Creates and returns a {@link Flyout}
*
* @return a new {@link Flyout}
*/
public JFXPopup createFlyout() {
marsNetBtn = new JFXButton();
// marsNetBtn.getStyleClass().add("menu-button");//"button-raised");
marsNetIcon = new IconNode(FontAwesome.COMMENTING_O);
marsNetIcon.setIconSize(20);
// marsNetButton.setPadding(new Insets(0, 0, 0, 0)); // Warning : this
// significantly reduce the size of the button image
setQuickToolTip(marsNetBtn, "Click to open MarsNet Chat Box");
marsNetBox = new JFXPopup(createChatBox());
marsNetBox.setOpacity(.9);
marsNetBtn.setOnAction(e -> {
if (!flag)
chatBox.update();
if (marsNetBox.isShowing()) {// .isVisible()) {
marsNetBox.hide();// .close();
} else {
openChatBox();
}
e.consume();
});
return marsNetBox;
}
示例10: init
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
@Override
protected void init() {
MainGameController.getRight().clear();
MainGameController.getLeft().clear();
boxes = new HashMap<>();
for (String part : RocketPart.allParts()) {
String type = part.split("_")[0];
String _class = part.split("_")[1];
if (!boxes.containsKey(type))
boxes.put(type, new HBox(10));
JFXButton b = new JFXButton();
b.setId("parts");
b.setGraphic(new ImageView(RocketPartData.image(type, _class, false)));
b.setTooltip(new Tooltip(_class + " " + type));
b.setOnAction((event) -> {
currPartString = new String[] { type, _class, "false" };
currPart.setImage(RocketPartData.image(currPartString[0], currPartString[1],
currPartString[2].equals("true") ? true : false));
});
boxes.get(type).getChildren().add(b);
if (Arrays.asList(RocketPart.FLIPPABLE_PARTS).contains(type)) {
JFXButton flipped = new JFXButton();
flipped.setId("parts");
flipped.setGraphic(new ImageView(RocketPartData.image(type, _class, true)));
flipped.setTooltip(new Tooltip(_class + " " + type));
flipped.setOnAction((event) -> currPartString = new String[] { type, _class, "true" });
boxes.get(type).getChildren().add(flipped);
}
}
MainGameController.getRight().addAll(boxes.values());
currPart = new ImageView();
JFXButton finish = new JFXButton(Language.get("complete") + "!");
finish.setOnAction(event -> {
if (createRocket())
State.setCurrentState(new MissionControlState(g, rocket));
});
finish.getStyleClass().add("button-raised1");
finish.setFocusTraversable(false);
name = new JFXTextField();
name.setPromptText(Language.get("rocket name"));
name.setFocusTraversable(false);
JFXButton save = new JFXButton(Language.get("save rocket"));
save.setOnAction(event -> saveRocket());
save.setFocusTraversable(false);
JFXButton load = new JFXButton(Language.get("load rocket"));
load.setOnAction(event -> loadRocket());
load.setFocusTraversable(false);
MainGameController.getLeft().addAll(currPart, new Separator(), finish, new Separator(), name, save, load);
}
示例11: createCommitButton
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
public void createCommitButton() {
commitButton = new JFXButton("Commit Change");//SubmitButton();
commitButton.setOnAction(e -> { //setOnMousePressed(e -> {
commitObjective();
/*
if (!running) {
timer.start();
running = true;
commitButton.setDisable(true);
}
e.consume();
*/
});
commitButton.setId("commit-button");
commitButton.setMaxWidth(150);
commitButton.setAlignment(Pos.CENTER);
//commitButton.statusProperty().addListener(o -> System.out.println(commitButton.getStatus()));
/*
progress = 0;
lastTimerCall = System.nanoTime();
timer = new AnimationTimer() {
@Override
public void handle(long now) {
if (now > lastTimerCall + 2_000l) {
progress += 0.005;
commitButton.setProgress(progress);
lastTimerCall = now;
if (toggle) {
if (progress > 0.75) {
progress = 0;
commitButton.setFailed();
timer.stop();
running = false;
toggle ^= true;
commitButton.setDisable(false);
// reset back to the old objective
resetButton();
}
} else {
if (progress > 1) {
progress = 0;
commitButton.setSuccess();
timer.stop();
running = false;
toggle ^= true;
commitButton.setDisable(false);
// set to the new objective
commitObjective();
}
}
}
}
};
*/
}
示例12: createTopButtonBar
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
public void createTopButtonBar() {
String guideURL, aboutURL, tutorialURL, shortcutsURL, wikiURL, projectsiteURL;
shortcutsURL = getClass().getResource(Msg.getString("doc.shortcuts")).toExternalForm(); //$NON-NLS-1$
guideURL = getClass().getResource(Msg.getString("doc.guide")).toExternalForm(); //$NON-NLS-1$
aboutURL = getClass().getResource(Msg.getString("doc.about")).toExternalForm(); //$NON-NLS-1$
tutorialURL = getClass().getResource(Msg.getString("doc.tutorial")).toExternalForm(); //$NON-NLS-1$
projectsiteURL = Msg.getString("url.projectsite"); //$NON-NLS-1$
wikiURL = Msg.getString("url.wiki"); //$NON-NLS-1$
JFXButton b0 = new JFXButton(Msg.getString("GuideWindow.button.about")); //$NON-NLS-1$
b0.setPadding(new Insets(5,15,5,15));
b0.setMinWidth(WIDTH+5);
b0.setTooltip(new Tooltip("About mars-sim"));
b0.setOnAction(e -> {
fireURL(aboutURL);
});
JFXButton b1 = new JFXButton(Msg.getString("GuideWindow.button.tutorial")); //$NON-NLS-1$
b1.setPadding(new Insets(5,15,5,15));
b1.setMinWidth(WIDTH+5);
b1.setTooltip(new Tooltip("Tutorial"));
b1.setOnAction(e -> {
fireURL(tutorialURL);
});
JFXButton b2 = new JFXButton(Msg.getString("GuideWindow.button.userguide")); //$NON-NLS-1$
b2.setPadding(new Insets(5,15,5,15));
b2.setMinWidth(WIDTH+5);
b2.setTooltip(new Tooltip("User Guide"));
b2.setOnAction(e -> {
fireURL(guideURL);
});
JFXButton b3 = new JFXButton(Msg.getString("GuideWindow.button.shortcuts")); //$NON-NLS-1$
b3.setPadding(new Insets(5,15,5,15));
b3.setMinWidth(WIDTH+5);
b3.setTooltip(new Tooltip("Shortcut Map"));
b3.setOnAction(e -> {
fireURL(shortcutsURL);
});
JFXButton b4 = new JFXButton(Msg.getString("GuideWindow.button.projectsite")); //$NON-NLS-1$
b4.setPadding(new Insets(5,15,5,15));
b4.setMinWidth(WIDTH+5);
b4.setTooltip(new Tooltip("GitHub's Project Site"));
b4.setOnAction(e -> {
fireURL(projectsiteURL);
});
JFXButton b5 = new JFXButton(Msg.getString("GuideWindow.button.wiki")); //$NON-NLS-1$
b5.setPadding(new Insets(5,15,5,15));
b5.setMinWidth(WIDTH+5);
b5.setTooltip(new Tooltip("GitHub Wikis"));
b5.setOnAction(e -> {
fireURL(wikiURL);
});
topButtonBar.setPadding(new Insets(5,5,5,5));
topButtonBar.getChildren().addAll(b0, b1, b2, b3, b4, b5);
}
示例13: dialogOnExit
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
/**
* Open the exit dialog box
* @param pane
*/
public void dialogOnExit(StackPane pane) {
isShowingDialog = true;
Label l = mainScene.createBlendLabel(Msg.getString("MainScene.exit.header"));
l.setPadding(new Insets(10, 10, 10, 10));
l.setFont(Font.font(null, FontWeight.BOLD, 14));
HBox hb = new HBox();
JFXButton b1 = new JFXButton("Exit");
b1.setStyle("-fx-background-color: white;");
JFXButton b2 = new JFXButton("Back");
b2.setStyle("-fx-background-color: white;");
hb.getChildren().addAll(b1, b2);
hb.setAlignment(Pos.CENTER);
HBox.setMargin(b1, new Insets(3,3,3,3));
HBox.setMargin(b2, new Insets(3,3,3,3));
VBox vb = new VBox();
vb.setAlignment(Pos.CENTER);
vb.setPadding(new Insets(5, 5, 5, 5));
vb.getChildren().addAll(l, hb);
StackPane sp = new StackPane(vb);
sp.setStyle("-fx-background-color:rgba(0,0,0,0.1);");
StackPane.setMargin(vb, new Insets(10,10,10,10));
JFXDialog dialog = new JFXDialog();
dialog.setDialogContainer(pane);
dialog.setContent(sp);
dialog.show();
b1.setOnAction(e -> {
isExit = true;
dialog.close();
Platform.exit();
System.exit(0);
});
b2.setOnAction(e -> {
dialog.close();
isShowingDialog = false;
e.consume();
});
}
示例14: createCalendarArrowsPane
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
protected BorderPane createCalendarArrowsPane() {
SVGGlyph leftChevron = new SVGGlyph(0,
"CHEVRON_LEFT",
"M 742,-37 90,614 Q 53,651 53,704.5 53,758 90,795 l 652,651 q 37,37 90.5,37 53.5,0 90.5,-37 l 75,-75 q 37,-37 37,-90.5 0,-53.5 -37,-90.5 L 512,704 998,219 q 37,-38 37,-91 0,-53 -37,-90 L 923,-37 Q 886,-74 832.5,-74 779,-74 742,-37 z",
Color.GRAY);
SVGGlyph rightChevron = new SVGGlyph(0,
"CHEVRON_RIGHT",
"m 1099,704 q 0,-52 -37,-91 L 410,-38 q -37,-37 -90,-37 -53,0 -90,37 l -76,75 q -37,39 -37,91 0,53 37,90 l 486,486 -486,485 q -37,39 -37,91 0,53 37,90 l 76,75 q 36,38 90,38 54,0 90,-38 l 652,-651 q 37,-37 37,-90 z",
Color.GRAY);
leftChevron.setFill(DEFAULT_COLOR);
leftChevron.setSize(6, 11);
rightChevron.setFill(DEFAULT_COLOR);
rightChevron.setSize(6, 11);
backMonthButton = new JFXButton();
backMonthButton.setMinSize(40, 40);
backMonthButton.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,
new CornerRadii(40),
Insets.EMPTY)));
backMonthButton.getStyleClass().add("left-button");
backMonthButton.setGraphic(leftChevron);
backMonthButton.setRipplerFill(this.datePicker.getDefaultColor());
backMonthButton.setOnAction(t -> forward(-1, MONTHS, false, true));
forwardMonthButton = new JFXButton();
forwardMonthButton.setMinSize(40, 40);
forwardMonthButton.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,
new CornerRadii(40),
Insets.EMPTY)));
forwardMonthButton.getStyleClass().add("right-button");
forwardMonthButton.setGraphic(rightChevron);
forwardMonthButton.setRipplerFill(this.datePicker.getDefaultColor());
forwardMonthButton.setOnAction(t -> forward(1, MONTHS, false, true));
BorderPane arrowsContainer = new BorderPane();
arrowsContainer.setLeft(backMonthButton);
arrowsContainer.setRight(forwardMonthButton);
arrowsContainer.setPadding(new Insets(4, 12, 2, 12));
arrowsContainer.setPickOnBounds(false);
return arrowsContainer;
}