本文整理汇总了Java中com.jfoenix.controls.JFXButton.setButtonType方法的典型用法代码示例。如果您正苦于以下问题:Java JFXButton.setButtonType方法的具体用法?Java JFXButton.setButtonType怎么用?Java JFXButton.setButtonType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jfoenix.controls.JFXButton
的用法示例。
在下文中一共展示了JFXButton.setButtonType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: 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();
}
示例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));
StackPane stackPane = new StackPane();
stackPane.autosize();
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
JFXButton okayBtn = new JFXButton(okayText);
okayBtn.addEventHandler(ActionEvent.ACTION, (e)-> {
dialog.close();
});
okayBtn.addEventHandler(ActionEvent.ACTION, okayAction);
okayBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
okayBtn.setPrefHeight(32);
okayBtn.setStyle(dialogBtnStyle);
JFXButton cancelBtn = new JFXButton(cancelText);
cancelBtn.addEventHandler(ActionEvent.ACTION, (e)-> {
dialog.close();
});
cancelBtn.addEventHandler(ActionEvent.ACTION, cancelAction);
cancelBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
cancelBtn.setPrefHeight(32);
cancelBtn.setStyle(dialogBtnStyle);
content.setActions(cancelBtn, okayBtn);
content.setPrefSize(dialogWidth, dialogHeight);
pane.getChildren().add(stackPane);
AnchorPane.setTopAnchor(stackPane, (pane.getHeight()-content.getPrefHeight())/2);
AnchorPane.setLeftAnchor(stackPane, (pane.getWidth()-content.getPrefWidth())/2);
dialog.show();
}
示例5: 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();
}
示例6: setButtonStyle
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
public void setButtonStyle(JFXButton button){
button.setStyle("-fx-background-color: #0091EA;");
button.setButtonType(JFXButton.ButtonType.RAISED);
button.setTextFill(Paint.valueOf("WHITE"));
}
示例7: init
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
/**
* init fxml when loaded.
*/
@PostConstruct
public void init() {
ArrayList<Node> children = new ArrayList<>();
for (int i = 0; i < 20; i++) {
StackPane child = new StackPane();
double width = Math.random() * 100 + 100;
child.setMinWidth(width);
child.setMaxWidth(width);
child.setPrefWidth(width);
double height = Math.random() * 100 + 100;
child.setMinHeight(height);
child.setMaxHeight(height);
child.setPrefHeight(height);
JFXDepthManager.setDepth(child, 1);
children.add(child);
// create content
StackPane header = new StackPane();
String headerColor = getDefaultColor(i % 12);
header.setStyle("-fx-background-radius: 5 5 0 0; -fx-background-color: " + headerColor);
VBox.setVgrow(header, Priority.ALWAYS);
StackPane body = new StackPane();
body.setMinHeight(Math.random() * 20 + 50);
VBox content = new VBox();
content.getChildren().addAll(header, body);
body.setStyle("-fx-background-radius: 0 0 5 5; -fx-background-color: rgb(255,255,255,0.87);");
// create button
JFXButton button = new JFXButton("");
button.setButtonType(ButtonType.RAISED);
button.setStyle("-fx-background-radius: 40;-fx-background-color: " + getDefaultColor((int) ((Math.random() * 12) % 12)));
button.setPrefSize(40, 40);
button.setRipplerFill(Color.valueOf(headerColor));
button.setScaleX(0);
button.setScaleY(0);
SVGGlyph glyph = new SVGGlyph(-1,
"test",
"M1008 6.286q18.857 13.714 15.429 36.571l-146.286 877.714q-2.857 16.571-18.286 25.714-8 4.571-17.714 4.571-6.286 "
+ "0-13.714-2.857l-258.857-105.714-138.286 168.571q-10.286 13.143-28 13.143-7.429 "
+ "0-12.571-2.286-10.857-4-17.429-13.429t-6.571-20.857v-199.429l493.714-605.143-610.857 "
+ "528.571-225.714-92.571q-21.143-8-22.857-31.429-1.143-22.857 18.286-33.714l950.857-548.571q8.571-5.143 18.286-5.143"
+ " 11.429 0 20.571 6.286z",
Color.WHITE);
glyph.setSize(20, 20);
button.setGraphic(glyph);
button.translateYProperty().bind(Bindings.createDoubleBinding(() -> {
return header.getBoundsInParent().getHeight() - button.getHeight() / 2;
}, header.boundsInParentProperty(), button.heightProperty()));
StackPane.setMargin(button, new Insets(0, 12, 0, 0));
StackPane.setAlignment(button, Pos.TOP_RIGHT);
Timeline animation = new Timeline(new KeyFrame(Duration.millis(240),
new KeyValue(button.scaleXProperty(),
1,
EASE_BOTH),
new KeyValue(button.scaleYProperty(),
1,
EASE_BOTH)));
animation.setDelay(Duration.millis(100 * i + 1000));
animation.play();
child.getChildren().addAll(content, button);
}
masonryPane.getChildren().addAll(children);
Platform.runLater(() -> scrollPane.requestLayout());
JFXScrollPane.smoothScrolling(scrollPane);
}