Material Design avec JavaFX et MaterialFX

Maven MaterialFX

<dependencies>
	<dependency>
		<groupId>org.openjfx</groupId>
		<artifactId>javafx-controls</artifactId>
		<version>18.0.1</version>
	</dependency>
	<dependency>
		<groupId>org.openjfx</groupId>
		<artifactId>javafx-fxml</artifactId>
		<version>18.0.1</version>
	</dependency>
	<dependency>
		<groupId>io.github.palexdev</groupId>
		<artifactId>materialfx</artifactId>
		<version>11.13.5</version>
	</dependency>
</dependencies>

MFXButton et MFXTextField

import io.github.palexdev.materialfx.controls.MFXButton;
import io.github.palexdev.materialfx.controls.MFXPasswordField;
import io.github.palexdev.materialfx.controls.MFXTextField;
import io.github.palexdev.materialfx.enums.ButtonType;
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

/**
 * JavaFX App
 */
public class App extends Application {

  @Override
  public void start(Stage stage) {

    // Champ texte TextField Material design
    MFXTextField mfxTextField = new MFXTextField();
    // 20 colonnes
    mfxTextField.setPrefColumnCount(20);
    // Le texte flottant au dessus du champ
    mfxTextField.setFloatingText("Email");

    // Le champ mot de passe
    MFXPasswordField mfxPasswordField = new MFXPasswordField();
    mfxPasswordField.setPrefColumnCount(17);
    mfxPasswordField.setFloatingText("Mot de passe");

    // Bouton Material
    MFXButton mfxButton = new MFXButton("Se connecter");
    // Type plat (Flat ou raised)
    mfxButton.setButtonType(ButtonType.FLAT);
    // Texte en blanc
    mfxButton.setTextFill(Color.WHITE);
    // Couleur du bouton
    mfxButton.setStyle("-fx-background-color: #7a0ed9;");

    // Elément racine
    VBox root = new VBox(mfxTextField, mfxPasswordField, mfxButton);
    // Centré
    root.setAlignment(Pos.CENTER);
    // Espace de 10
    root.setSpacing(10);

    Scene scene = new Scene(root, 640, 480);
    stage.setScene(scene);
    stage.show();

  }

  public static void main(String[] args) {
    launch();
  }

}

Commentaires

  1. The High Limit Slot Room covers over 13,000 sq. feet with over 200 slot machines. A lack of data means it’s impossible to know the size of the activity, though it quantities to “many billions of dollars every year,” it mentioned. We offer the premier gaming experience in Pittsburgh with over 65 table games, together with craps, blackjack, roulette and many of|and a lot of} more of your 메이저놀이터 favourite games in spacious and comfy environment. You'll discover quantity of} progressive video poker games on the on line casino flooring.

    RĂ©pondreSupprimer

Enregistrer un commentaire