@Override
  public void initialize(URL arg0, ResourceBundle arg1) {

    initRectangle();
    initLogo();
    initTreeView();
    initGenButton();
    AddDbAction addDbAction = new AddDbAction(mItemMySql);
    for (int i = 0; i < 50; i++) {
      SelectLabel label = new SelectLabel("asd");

      label.setWrapText(true);
      label.setGraphic(new ImageView(Context.Icon_Table2));
      label.getStyleClass().add("label1");

      flowPane.getChildren().add(label);
    }

    flowPane.setPadding(new Insets(5, 0, 0, 5));
    flowPane.setVgap(5);
    flowPane.setHgap(5);
    flowPane.setMaxSize(200d, 200d);
    flowPane.autosize();

    flowPaneRoot.getChildren().add(selection);
  }
 /**
  * Creates a FlowPane layout with the specified orientation and hgap/vgap.
  *
  * @param orientation the direction the tiles should flow & wrap
  * @param hgap the amount of horizontal space between each tile
  * @param vgap the amount of vertical space between each tile
  * @param children The initial set of children for this pane.
  * @since JavaFX 8.0
  */
 public FlowPane(Orientation orientation, double hgap, double vgap, Node... children) {
   this();
   setOrientation(orientation);
   setHgap(hgap);
   setVgap(vgap);
   getChildren().addAll(children);
 }
 private FlowPane createAssignedUserPane() {
   FlowPane assignedUserPane = new FlowPane();
   assignedUserPane.setPadding(new Insets(5, 5, 5, 5));
   assignedUserPane.setHgap(3);
   assignedUserPane.setVgap(5);
   assignedUserPane.setStyle("-fx-border-radius: 3;");
   return assignedUserPane;
 }
Exemple #4
0
  @Override
  public void start(Stage primaryStage) {
    Image[] images = new Image[10];
    for (int i = 0; i < 8; i++) {
      images[i] = new Image("de/javafxbuch/" + (i + 2) + "_of_hearts.png", 50, 72, true, true);
    }
    FlowPane iconView = new FlowPane();
    iconView.setVgap(10);
    iconView.setHgap(20);
    for (int i = 0; i < images.length; i++) {
      iconView.getChildren().add(new ImageView(images[i]));
    }
    primaryStage.setScene(new Scene(new StackPane(iconView), 300, 200));

    primaryStage.show();
  }
  @Override
  public void start(Stage primaryStage) {

    thestage = primaryStage;
    // can now use the stage in other methods
    // make things to put on panes
    btnscene1 = new Button("Click to go to Other Scene");
    btnscene2 = new Button("Click to go back to First Scene");
    btnscene1.setOnAction(e -> ButtonClicked(e));
    btnscene2.setOnAction(e -> ButtonClicked(e));
    lblscene1 = new Label("Scene 1");
    lblscene2 = new Label("Scene 2");

    // make 2 Panes
    pane1 = new FlowPane();
    pane2 = new FlowPane();
    pane1.setHgap(20);
    pane2.setVgap(10);
    // set background color of each Pane
    pane1.setStyle("-fx-background-color:tan;-fx-padding:10px;");
    pane2.setStyle("-fx-background-color:red;-fx-padding:10px;");
    // add everything to panes
    pane1.getChildren().addAll(lblscene1, btnscene1);
    pane2.getChildren().addAll(lblscene2, btnscene2);

    // make 2 scenes from 2 panes
    scene1 = new Scene(pane1, 200, 100);
    scene2 = new Scene(pane2, 200, 100);
    // make another stage for scene2
    newStage = new Stage();
    newStage.setScene(scene2);
    // tell stage it is meannt to pop-up (Modal)
    newStage.initModality(Modality.APPLICATION_MODAL);
    newStage.setTitle("Pop up window");
    // rest of code -
    primaryStage.setTitle("Hello World!");
    primaryStage.setScene(scene1);
    primaryStage.setMinWidth(300);
    primaryStage.show();
  }
 /**
  * Creates a horizontal FlowPane layout with the specified hgap/vgap.
  *
  * @param hgap the amount of horizontal space between each tile
  * @param vgap the amount of vertical space between each tile
  * @param children The initial set of children for this pane.
  * @since JavaFX 8.0
  */
 public FlowPane(double hgap, double vgap, Node... children) {
   this();
   setHgap(hgap);
   setVgap(vgap);
   getChildren().addAll(children);
 }
 /**
  * Creates a FlowPane layout with the specified orientation and hgap/vgap.
  *
  * @param orientation the direction the tiles should flow & wrap
  * @param hgap the amount of horizontal space between each tile
  * @param vgap the amount of vertical space between each tile
  */
 public FlowPane(Orientation orientation, double hgap, double vgap) {
   this();
   setOrientation(orientation);
   setHgap(hgap);
   setVgap(vgap);
 }
 /**
  * Creates a horizontal FlowPane layout with the specified hgap/vgap.
  *
  * @param hgap the amount of horizontal space between each tile
  * @param vgap the amount of vertical space between each tile
  */
 public FlowPane(double hgap, double vgap) {
   this();
   setHgap(hgap);
   setVgap(vgap);
 }
  @Override
  public void start(Stage stage) {

    stage.setTitle("FX Keyboard (" + System.getProperty("javafx.runtime.version") + ")");
    stage.setResizable(true);

    popup =
        KeyBoardPopupBuilder.create()
            .initLocale(Locale.ENGLISH)
            .addIRobot(RobotFactory.createFXRobot())
            .build();
    popup
        .getKeyBoard()
        .setOnKeyboardCloseButton(
            new EventHandler<Event>() {
              public void handle(Event event) {
                setPopupVisible(false, null);
              }
            });

    FlowPane pane = new FlowPane();
    pane.setVgap(20);
    pane.setHgap(20);
    pane.setPrefWrapLength(100);

    final TextField tf = new TextField("");
    final TextArea ta = new TextArea("");

    Button okButton = new Button("Ok");
    okButton.setDefaultButton(true);

    Button cancelButton = new Button("Cancel");
    cancelButton.setCancelButton(true);

    pane.getChildren().add(new Label("Text1"));
    pane.getChildren().add(tf);
    pane.getChildren().add(new Label("Text2"));
    pane.getChildren().add(ta);
    pane.getChildren().add(okButton);
    pane.getChildren().add(cancelButton);
    // pane.getChildren().add(KeyBoardBuilder.create().addIRobot(RobotFactory.createFXRobot()).build());
    Scene scene = new Scene(pane, 200, 300);

    // add keyboard scene listener to all text components
    scene
        .focusOwnerProperty()
        .addListener(
            new ChangeListener<Node>() {
              @Override
              public void changed(ObservableValue<? extends Node> value, Node n1, Node n2) {
                if (n2 != null && n2 instanceof TextInputControl) {
                  setPopupVisible(true, (TextInputControl) n2);

                } else {
                  setPopupVisible(false, null);
                }
              }
            });

    String css = this.getClass().getResource("/css/KeyboardButtonStyle.css").toExternalForm();
    scene.getStylesheets().add(css);
    stage.setOnCloseRequest(
        new EventHandler<WindowEvent>() {

          public void handle(WindowEvent event) {
            System.exit(0);
          }
        });
    popup.show(stage);
    stage.setScene(scene);
    stage.show();
  }
  public BoardView(int noPlayers, final Stage primaryStage) {

    window = primaryStage;
    window.setTitle("Quoridor");
    window.setMaxHeight(1280);
    window.setMaxWidth(1280);
    window.setResizable(false);

    BorderPane border = new BorderPane();

    infoPane = new FlowPane();
    infoPane.setPadding(new Insets(10));
    infoPane.setHgap(40);
    infoPane.setVgap(10);
    infoPane.setOrientation(Orientation.HORIZONTAL);

    bottomPane = new HBox();
    bottomPane.setSpacing(345);

    gameGrid = new GridPane();
    gameGrid.setPadding(new Insets(4));
    gameGrid.setId("gamegrid");

    border.setTop(infoPane);
    border.setCenter(gameGrid);

    playerPositionButtons = new PlayerPositionButton[9][9];
    wallPositionButtons = new WallPositionButton[9][8];
    horizontalWalls = new Pane[9][9];
    verticalWalls = new Pane[9][9];

    column = 0;
    row = 0;

    chooseVertical = new Button();
    chooseVertical.setPrefSize(100, 100);
    chooseVertical.setId("vWallBtn");

    Button home = new Button();
    home.setPrefSize(100, 100);
    home.setId("home");
    home.setOnAction(e -> confirmBox());

    bottomPane.getChildren().addAll(chooseVertical, home);

    border.setBottom(bottomPane);
    border.setMargin(bottomPane, new Insets(40, 40, 20, 20));

    for (int y = 0; y < 8; y++) {
      createMoveLine(y);
      createWallLine(y);
    }

    createMoveLine(8);

    main = new Scene(border, 600, 768);
    main.getStylesheets().add("gameplay/viewJFX/" + stylesheet);
    buildPlayerLabels(noPlayers);
    window.setScene(main);
    window.show();
  }
Exemple #11
0
  private FlowPane buildLowerArea() {

    FlowPane flow = new FlowPane();
    flow.setPadding(new Insets(10, 10, 10, 10));
    flow.prefHeightProperty().bind(this.heightProperty());
    flow.prefWidthProperty().bind(this.widthProperty());

    flow.setVgap(8);
    flow.setHgap(4);

    Button startDebbtn = new Button("Start New Debate");
    startDebbtn.setPrefSize(150, 50);

    Button judger1btn = new Button("Judge Round 1");
    judger1btn.setDisable(true);
    judger1btn.setPrefSize(150, 50);

    Button judger2btn = new Button("Judge Round 2");
    judger2btn.setDisable(true);
    judger2btn.setPrefSize(150, 50);

    Button judger3btn = new Button("Judge Round 3");
    judger3btn.setDisable(true);
    judger3btn.setPrefSize(150, 50);

    Button judger4btn = new Button("Judge Round 4");
    judger4btn.setDisable(true);
    judger4btn.setPrefSize(150, 50);

    Button finalResbtn = new Button("Final Result");
    finalResbtn.setDisable(true);
    finalResbtn.setPrefSize(150, 50);

    Hyperlink termhp = new Hyperlink("Terminate Current Match/Start New");

    flow.getChildren()
        .addAll(startDebbtn, judger1btn, judger2btn, judger3btn, judger4btn, finalResbtn, termhp);

    termhp.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {

            judger1btn.setDisable(true);
            judger2btn.setDisable(true);
            judger3btn.setDisable(true);
            judger4btn.setDisable(true);
            finalResbtn.setDisable(true);
          }
        });

    startDebbtn.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {

            new MatchManager().StartMatch();
          }
        });

    return flow;
  }