Java Code Examples for com.jfoenix.controls.JFXButton#setStyle()

The following examples show how to use com.jfoenix.controls.JFXButton#setStyle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AdminAddUserViewController.java    From Corendon-LostLuggage with MIT License 6 votes vote down vote up
public void showConfirmedMessage(String headerString, String messageString, String buttonString) {
    Text header = new Text(headerString);
    header.setFont(new Font("System", 18));
    header.setFill(Paint.valueOf("#495057"));
    MESSAGE_FLOW.getChildren().clear();
    MESSAGE_FLOW.getChildren().add(new Text(messageString));
    DIALOG_LAYOUT.getActions().clear();
    DIALOG_LAYOUT.setHeading(header);
    DIALOG_LAYOUT.setBody(MESSAGE_FLOW);

    JFXButton okButton = new JFXButton(buttonString);

    okButton.setStyle("-fx-background-color: #4dadf7");
    okButton.setTextFill(Paint.valueOf("#FFFFFF"));
    okButton.setRipplerFill(Paint.valueOf("#FFFFFF"));
    okButton.setButtonType(JFXButton.ButtonType.RAISED);
    DIALOG_LAYOUT.setActions(okButton);
    okButton.setOnAction(e -> {
        alertView.close();
        stackPane.setVisible(false);
    });
}
 
Example 2
Source File: ManagerRetrievedViewController.java    From Corendon-LostLuggage with MIT License 5 votes vote down vote up
private void showAlertMessage() {
    stackPane.setVisible(true);
    MESSAGE_FLOW.getChildren().clear();

    //Customize header
    Text header = new Text(alertHeader);
    header.setFont(new Font("System", 18));
    header.setFill(Paint.valueOf(headerColor));

    JFXButton hideMessageButton = new JFXButton(buttonText);
    //Customize button
    hideMessageButton.setStyle("-fx-background-color: #4dadf7");
    hideMessageButton.setTextFill(Paint.valueOf("#FFFFFF"));
    hideMessageButton.setRipplerFill(Paint.valueOf("#FFFFFF"));
    hideMessageButton.setButtonType(JFXButton.ButtonType.RAISED);

    MESSAGE_FLOW.getChildren().add(new Text(alert));
    DIALOG_LAYOUT.setHeading(header);
    DIALOG_LAYOUT.setBody(MESSAGE_FLOW);
    DIALOG_LAYOUT.setActions(hideMessageButton);
    JFXDialog alertView = new JFXDialog(stackPane, DIALOG_LAYOUT, JFXDialog.DialogTransition.CENTER);
    alertView.setOverlayClose(false);
    hideMessageButton.setOnAction(e -> {
        alertView.close();
        stackPane.setVisible(false);
    });

    alertView.show();
}
 
Example 3
Source File: SettingsViewController.java    From Corendon-LostLuggage with MIT License 5 votes vote down vote up
private void showAlertMessage() {
    stackPane.setVisible(true);
    MESSAGE_FLOW.getChildren().clear();

    //Customize header
    Text header = new Text(alertHeader);
    header.setFont(new Font("System", 18));
    header.setFill(Paint.valueOf(headerColor));

    JFXButton hideMessageButton = new JFXButton(buttonText);
    //Customize button
    hideMessageButton.setStyle("-fx-background-color: #4dadf7");
    hideMessageButton.setTextFill(Paint.valueOf("#FFFFFF"));
    hideMessageButton.setRipplerFill(Paint.valueOf("#FFFFFF"));
    hideMessageButton.setButtonType(JFXButton.ButtonType.RAISED);

    MESSAGE_FLOW.getChildren().add(new Text(alert));
    DIALOG_LAYOUT.setHeading(header);
    DIALOG_LAYOUT.setBody(MESSAGE_FLOW);
    DIALOG_LAYOUT.setActions(hideMessageButton);
    JFXDialog alertView = new JFXDialog(stackPane, DIALOG_LAYOUT, JFXDialog.DialogTransition.CENTER);
    alertView.setOverlayClose(false);
    hideMessageButton.setOnAction(e -> {
        alertView.close();
        stackPane.setVisible(false);
    });

    alertView.show();
}
 
Example 4
Source File: LogInViewController.java    From Corendon-LostLuggage with MIT License 5 votes vote down vote up
private void showAlertMessage() {
    stackPane.setVisible(true);
    MESSAGE_FLOW.getChildren().clear();

    //Customize header
    Text header = new Text(alertHeader);
    header.setFont(new Font("System", 18));
    header.setFill(Paint.valueOf(headerColor));

    JFXButton hideMessageButton = new JFXButton(buttonText);
    //Customize button
    hideMessageButton.setStyle("-fx-background-color: #4dadf7");
    hideMessageButton.setTextFill(Paint.valueOf("#FFFFFF"));
    hideMessageButton.setRipplerFill(Paint.valueOf("#FFFFFF"));
    hideMessageButton.setButtonType(JFXButton.ButtonType.RAISED);

    MESSAGE_FLOW.getChildren().add(new Text(alert));
    DIALOG_LAYOUT.setHeading(header);
    DIALOG_LAYOUT.setBody(MESSAGE_FLOW);
    DIALOG_LAYOUT.setActions(hideMessageButton);
    JFXDialog alertView = new JFXDialog(stackPane, DIALOG_LAYOUT, JFXDialog.DialogTransition.CENTER);
    alertView.setOverlayClose(false);
    hideMessageButton.setOnAction(e -> {
        alertView.close();
        stackPane.setVisible(false);
    });

    alertView.show();
}
 
Example 5
Source File: DashboardController.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public void initSButtons() {
       	//System.out.println("initSButtons()");
//    	num = unitManager.getSettlementNum();
    	num = settlements.size();
    	//buttonVBox.getChildren().add(btnMars);
    	
    	for (int i=0; i<num; i++) {
//    		final ImageView imageView = new ImageView(new Image("http://icons.iconarchive.com/icons/eponas-deeway/colobrush/128/heart-2-icon.png") );
    		IconNode icon = new IconNode(FontAwesome.USERS);//.ADDRESS_BOOK_O);
    		icon.setIconSize(17);
    		icon.setFill(Color.web(PALE_BLUE));
    		icon.setWrappingWidth(25);
    		//size="17.0" wrappingWidth="43.0"
    		// icon.setStroke(Color.WHITE);
    		JFXButton btn = new JFXButton(settlements.get(i).getName(), icon);	
    		//btn.setMaxSize(20, 20);
    		//btn.setGraphic(icon);
    		buttonVBox.getChildren().add(btn);		
    		btn.setLayoutX(10);
    		btn.setLayoutY(109);
    		btn.setPrefHeight(42);
    		//btn.setPrefWidth(250);
    		btn.setAlignment(Pos.CENTER_LEFT);
    		btn.setStyle("jfxbutton");
    		btn.setTextFill(Color.LIGHTBLUE);
    		// layoutX="10.0" layoutY="109.0" onAction="#handleS0" prefHeight="42.0" prefWidth="139.0" 
            // style="-fx-alignment: center-left;" styleClass="jfxbutton" text="s0" textFill="#a1aec4"
    		final int x = i;
    		btn.setOnAction(e -> handleList(settlements.get(x)));
    	}
    	
    }
 
Example 6
Source File: MainMenu.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public static StackPane getExitDialogPane(JFXButton b1, JFXButton b2, JFXButton b3) {
	Label l = new Label("Do you really want to exit ?");// mainScene.createBlendLabel(Msg.getString("MainScene.exit.header")); // 
	l.setPadding(new Insets(10, 10, 10, 10));
	l.setFont(Font.font(null, FontWeight.BOLD, 14));
	l.setStyle("-fx-text-fill: white;");
	
	b1.setStyle("-fx-background-color: grey;-fx-text-fill: white;");
	b2.setStyle("-fx-background-color: grey;-fx-text-fill: white;");
	if (b3 != null)
		b3.setStyle("-fx-background-color: grey;-fx-text-fill: white;");
	
	HBox hb = new HBox();
	hb.setAlignment(Pos.CENTER);
	if (b3 != null)
		hb.getChildren().addAll(b1, b2, b3);
	else
		hb.getChildren().addAll(b1, b2);
	
	HBox.setMargin(b1, new Insets(3, 3, 3, 3));
	HBox.setMargin(b2, new Insets(3, 3, 3, 3));
	if (b3 != null)
		HBox.setMargin(b3, 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: black;");
	StackPane.setMargin(vb, new Insets(10, 10, 10, 10));
	return sp;
}
 
Example 7
Source File: MainScene.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public void createMapButtons() {
	rotateCWBtn = new JFXButton();
	rotateCWBtn.setOpacity(1);
	rotateCWBtn.setGraphic(new ImageView(new Image(this.getClass().getResourceAsStream(Msg.getString("img.cw"))))); //$NON-NLS-1$
	rotateCWBtn.setStyle("-fx-background-color: transparent; ");
	setQuickToolTip(rotateCWBtn, Msg.getString("SettlementTransparentPanel.tooltip.clockwise"));
	rotateCWBtn.setOnAction(e -> {
		mapPanel.setRotation(mapPanel.getRotation() + ROTATION_CHANGE);
		e.consume();
	});

	rotateCCWBtn = new JFXButton();
	rotateCCWBtn.setOpacity(1);
	rotateCCWBtn
			.setGraphic(new ImageView(new Image(this.getClass().getResourceAsStream(Msg.getString("img.ccw"))))); //$NON-NLS-1$
	rotateCCWBtn.setStyle("-fx-background-color: transparent; ");
	setQuickToolTip(rotateCCWBtn, Msg.getString("SettlementTransparentPanel.tooltip.counterClockwise"));
	rotateCCWBtn.setOnAction(e -> {
		mapPanel.setRotation(mapPanel.getRotation() - ROTATION_CHANGE);
		e.consume();
	});

	recenterBtn = new JFXButton();
	recenterBtn.setOpacity(1);
	recenterBtn.setGraphic(
			new ImageView(new Image(this.getClass().getResourceAsStream(Msg.getString("img.recenter"))))); //$NON-NLS-1$
	recenterBtn.setStyle("-fx-background-color: transparent; ");
	setQuickToolTip(recenterBtn, Msg.getString("SettlementTransparentPanel.tooltip.recenter"));
	recenterBtn.setOnAction(e -> {
		mapPanel.reCenter();
		zoomSlider.setValue(DEFAULT_ZOOM);
		e.consume();
	});

}
 
Example 8
Source File: AdminAddUserViewController.java    From Corendon-LostLuggage with MIT License 4 votes vote down vote up
@FXML
private void showPasswordResetMessage(ActionEvent event) throws IOException {
    stackPane.setVisible(true);
    MESSAGE_FLOW.getChildren().clear();
    userId = employeeIdField.getText();

    //Customize header
    Text header = new Text("Note: This action can't be undone");
    header.setFont(new Font("System", 18));
    header.setFill(Paint.valueOf("#495057"));

    JFXButton cancelButton = new JFXButton("Cancel");
    JFXButton resetButton = new JFXButton("Reset");

    //Customize buttons
    cancelButton.setStyle("-fx-background-color: #adb5bd");
    cancelButton.setTextFill(Paint.valueOf("#FFFFFF"));
    cancelButton.setRipplerFill(Paint.valueOf("#FFFFFF"));
    cancelButton.setButtonType(JFXButton.ButtonType.RAISED);

    resetButton.setStyle("-fx-background-color: #4dadf7");
    resetButton.setTextFill(Paint.valueOf("#FFFFFF"));
    resetButton.setRipplerFill(Paint.valueOf("#FFFFFF"));
    resetButton.setButtonType(JFXButton.ButtonType.RAISED);

    MESSAGE_FLOW.getChildren().add(new Text("Are you sure you want to reset the password of user: " + userId));
    DIALOG_LAYOUT.setHeading(header);
    DIALOG_LAYOUT.setBody(MESSAGE_FLOW);
    DIALOG_LAYOUT.setActions(cancelButton, resetButton);
    //DIALOG_LAYOUT.setActions(resetButton);

    alertView = new JFXDialog(stackPane, DIALOG_LAYOUT, JFXDialog.DialogTransition.CENTER);
    alertView.setOverlayClose(false);
    cancelButton.setOnAction(e -> {
        alertView.close();
        stackPane.setVisible(false);
    });

    resetButton.setOnAction(e -> {
        System.out.println("The password has been reset");
        //alertView.close();
        try {
            resetPassword();
        } catch (SQLException ex) {
            Logger.getLogger(AdminAddUserViewController.class.getName()).log(Level.SEVERE, null, ex);
        }

    });

    alertView.show();
}
 
Example 9
Source File: MasonryPaneController.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
/**
 * 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.setPrefWidth(width);
        double height = Math.random() * 100 + 100;
        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);
}