本文整理汇总了Java中com.jfoenix.controls.JFXButton.setStyle方法的典型用法代码示例。如果您正苦于以下问题:Java JFXButton.setStyle方法的具体用法?Java JFXButton.setStyle怎么用?Java JFXButton.setStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jfoenix.controls.JFXButton
的用法示例。
在下文中一共展示了JFXButton.setStyle方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: 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();
}
示例4: 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();
}
示例5: valueSetter
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
private void valueSetter(JFXButton btn, int serial) { //Will Change Button Appearance on click
if (!clicked[serial]) {
clicked[serial] = true;
edges[serial].setDisable(false);
edges[serial].setText("1");
btn.setStyle("-fx-background-color: " + colors[serial]
+ "; -fx-border-color: #FF0000; -fx-border-width: 3;"
+ " -fx-background-radius: 10 10 10 10;"
+ "; -fx-border-radius: 10 10 10 10;");
} else {
clicked[serial] = false;
edges[serial].setDisable(true);
edges[serial].setText("∞");
btn.setStyle("-fx-background-color: " + colors[serial]
+ "; -fx-border-color: #000000;"
+ " -fx-background-radius: 10 10 10 10;"
+ "; -fx-border-radius: 10 10 10 10;");
}
}
示例6: 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;
}
示例7: 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();
}
示例8: unmarkNotSelectedButtons
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
public void unmarkNotSelectedButtons(JFXButton button) {
for (JFXButton btn : Arrays.asList(homeBtn, filesBtn, informationBtn, endFileBtn, advancedSelectionId, showParsedDataBtn)) {
if (btn != button) {
btn.setStyle("-fx-background-color: #00A65A;-fx-font-size: 16;-fx-font-weight:bold;-fx-text-fill:white");
}
}
}
示例9: 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();
}
示例10: 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"));
}
示例11: handleSelection
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
private void handleSelection(JFXButton selectedBtn) {
selectedBtn.setStyle("-fx-background-color: #6aae31;-fx-font-size: 16;-fx-font-weight:bold;-fx-text-fill:white");
mainWindowController.unmarkNotSelectedButtons(selectedBtn);
}
示例12: KopaShamsuKopa
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
private void KopaShamsuKopa(JFXButton btnx, int i) {
if (selection[i]) {
btnx.setStyle("-fx-background-color:" + colors[i] + "; -fx-background-radius: 35 35 35 35");
selection[i] = false;
--selectionCtr;
} else {
if (selectionCtr == 0) {
if (newInstance) {
for (int t = 0; t < step; t++) {
newInstance = false;
btn[t].setStyle("-fx-background-color:" + colors[t] + "; -fx-background-radius: 35 35 35 35");;
}
}
btnx.setStyle("-fx-background-color:" + colors[i] + "; -fx-border-color: #00BFA5; -fx-border-width: 3");
selection[i] = true;
first = i;
temp = btnx;
++selectionCtr;
} else {
double res = shortestPath[step][first][i];
//TO DO FIND PATH SEQUENCE
//Genearating sequence
String result = "";
if (res != Double.POSITIVE_INFINITY) {
ArrayList<Integer> seq = sequenceGen(first + 1, i + 1);
int flag = 0;
for (Integer trav : seq) {
if (flag != 0) {
result += " -> " + vertex[trav - 1];
} else {
result += vertex[trav - 1];
flag++;
}
btn[trav - 1].setStyle("-fx-border-color: #000000;"
+ " -fx-background-color:" + colors[trav - 1]
+ "; -fx-background-radius: 20 0 20 0"
+ "; -fx-border-width: 3; -fx-border-radius: 20 0 20 0");
}
} else {
result = "No available path!";
btn[first].setStyle("-fx-background-color:" + colors[first] + "; -fx-background-radius: 35 35 35 35");;
}
resultLabel.setText("Path: " + result + " Dist: " + Double.toString(res));
selection[first] = false;
selection[i] = false;
selectionCtr = 0;
newInstance = true;
}
}
}
示例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: 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);
}