示例#1
0
  public FamilyForm() {

    getStylesheets().add("/CSS/familyFormCss.css");

    save = new Button("Save");
    cancel = new Button("Cancel");

    Title.setFontSmoothingType(FontSmoothingType.LCD);
    Title.setFont(javafx.scene.text.Font.font(20));

    scrollPane = new ScrollPane(getSubGrid());
    scrollPane.setFitToWidth(true);

    save.setPrefWidth(80);
    cancel.setPrefWidth(80);

    clientID = Controller.getInstance().getStaffInfo().getAccountID();

    /////////////////////////////////// MAIN PANE ///////////////////////////////////

    setConstraints(Title, 0, 0, 1, 1, HPos.CENTER, VPos.CENTER);
    setConstraints(scrollPane, 0, 1, 1, 1, HPos.CENTER, VPos.CENTER);

    getChildren().addAll(Title, scrollPane);

    save.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            if (Validate()) {
              String name = Name.getText().trim();

              if (Controller.isNotified && orginalName.equals("")) {
                orginalName = name;
              } else if (Controller.isNotified && !(orginalName.equals(""))) {
                if (!orginalName.equals(name)) {
                  orginalName = name;
                  Controller.isNotified = false;
                }
              }
              Save();
            }
          }
        });

    cancel.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            clear();
          }
        });
  }
示例#2
0
文件: Main.java 项目: yonesko/edoC
  @Override
  public void start(Stage primaryStage) throws Exception {
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setVgap(10);
    grid.setHgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    Scene sc = new Scene(grid, 500, 500);

    String css = Main.class.getResource("Login.css").toExternalForm();
    //        System.out.println(css);
    sc.getStylesheets().add(css);

    Text scenetitle = new Text("Welcome");
    //        scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    grid.add(scenetitle, 0, 0, 1, 1);

    Label userName = new Label("User Name:");
    grid.add(userName, 0, 1);

    TextField userTextField = new TextField("Мудак");
    grid.add(userTextField, 1, 1);

    Label pw = new Label("Password:"******"Sign in");
    HBox hbBtn = new HBox(10);
    hbBtn.setAlignment(Pos.BOTTOM_RIGHT);
    hbBtn.getChildren().add(btn);
    grid.add(hbBtn, 1, 4);

    final Text actiontarget = new Text();
    grid.add(actiontarget, 1, 6);

    btn.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            //                actiontarget.setFill(Color.FIREBRICK);
            actiontarget.setText("Pressed");
          }
        });

    //        grid.setGridLinesVisible(true);

    scenetitle.setId("welc");
    actiontarget.setId("act");

    primaryStage.setScene(sc);
    primaryStage.setTitle("Hello World");
    primaryStage.show();
  }