Exemple #1
1
  public void loadMapNumbers(Group root) {
    Group group = new Group();
    group.setLayoutX(600);
    group.setLayoutY(600);

    cb = new ChoiceBox();
    loadNumberChoiceBox();

    Button b1 = new Button("Go");
    b1.setLayoutY(25);
    Gui.Listener.EditorChangeMapListener editorCML = new Gui.Listener.EditorChangeMapListener();
    editorCML.setChoiceBox(cb);
    b1.setOnAction(editorCML);

    Button b2 = new Button("Delete");
    b2.setLayoutY(50);

    editorCML.setChoiceBox(cb);
    b1.setOnAction(editorCML);

    group.getChildren().add(b1);
    group.getChildren().add(b2);
    group.getChildren().add(cb);
    root.getChildren().add(group);
  }
Exemple #2
0
  public void loadMapEditor(Group root) {
    Logic.Images.LoadImagesEditor li = new LoadImagesEditor();
    li.loadMapEditor();

    Group meGroup = new Group();
    ivHover = new ImageView(Objekte.getImgMapEditor().getSingleBorderHover());
    ivHover.setVisible(true);

    Gui.Listener.EditorHoverListener eHoverL = new Gui.Listener.EditorHoverListener(ivHover);

    for (int y = 0; y < Objekte.getMapData().getMapSizeY(); y++) {
      for (int x = 0; x < Objekte.getMapData().getMapSizeX(); x++) {

        ImageView iv = new ImageView(Objekte.getImgMapEditor().getSingleBorder());
        iv.setLayoutX(x * 25);
        iv.setLayoutY(y * 25);
        eHoverL.addImageView(iv);
        iv.hoverProperty().addListener(eHoverL);
        meGroup.getChildren().add(iv);
      }
    }

    root.getChildren().add(meGroup);
    root.getChildren().add(ivHover);

    loadEditorPalette(root);
    loadMapUI(root);
    loadEditorButtons(root);
    loadMapNumbers(root);
  }
Exemple #3
0
  public void remove(int k) {
    try {
      zAxisData.remove(k);
      xAxisData.remove(k);
      yAxisData.remove(k);
    } catch (Exception e) {
      e.printStackTrace();
    }

    Platform.runLater(
        () -> {
          scatterDataGroup.getChildren().clear();
          for (int i = 0; i < zAxisData.size(); i++) {
            final Sphere dataSphere = new Sphere(scatterRadius);
            double translateX = 0.0;
            double translateY = 0.0;
            if (!xAxisData.isEmpty() && xAxisData.size() > i) translateX = xAxisData.get(i);
            if (!yAxisData.isEmpty() && yAxisData.size() > i) translateY = yAxisData.get(i);
            dataSphere.setTranslateX(translateX);
            dataSphere.setTranslateY(translateY);
            dataSphere.setTranslateZ(zAxisData.get(i));
            scatterDataGroup.getChildren().add(dataSphere);
          }
        });
  }
  public Scene initialize(Stage s) {
    stage = s;
    Group root = new Group();
    Text t =
        new Text(
            260,
            100,
            " Escape From New Pangea                               The Survival of Humankind");
    t.setWrappingWidth(500);
    t.setFont(Font.font("Verdana", 20));
    t.setFill(Color.AZURE);
    Button b = new Button("Click to start");
    ImageView im = new ImageView(new Image("images/Gobi_Desert.jpg"));
    b.setLayoutX(300);
    b.setLayoutY(275);
    b.setMinWidth(200);
    b.setMinHeight(50);
    b.setOnMouseClicked(e -> startGame(e));
    root.getChildren().add(im);
    root.getChildren().add(t);
    root.getChildren().add(b);

    Scene scene = new Scene(root, 800, 600, Color.WHITE);
    return scene;
  }
Exemple #5
0
  /*
   * initialize the spheres
   */
  public void initializeParam() {
    lightSetting();

    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < 5; j++) {
        for (int k = 0; k < 5; k++) {
          fingerCoor[i][j][k] = new Point3D(0, 0, -100);
          fingerNode[i][j][k] = new VisSphere(fingerSize);
          root.getChildren().add(fingerNode[i][j][k]);
        }
        fingerLine[i][j] = new PolyCylinder3D(getPoint3DArray(i, j), 5, Color.WHITE);
        root.getChildren().addAll(fingerLine[i][j].getLine());
      }
      palmCoor[i] = new Point3D(0, 0, -100);
      palmNode[i] = new VisSphere(palmSize);
      palmLine[i] = new PolyCylinder3D(getPoint3DArray(i), 7, Color.WHITE);
      root.getChildren().addAll(palmLine[i].getLine());
      root.getChildren().add(palmNode[i]);
    }
    // for better appearance, some nodes are hidden
    fingerNode[0][1][4].setVisible(false);
    fingerNode[0][2][4].setVisible(false);
    fingerNode[0][3][4].setVisible(false);
    fingerNode[1][1][4].setVisible(false);
    fingerNode[1][2][4].setVisible(false);
    fingerNode[1][3][4].setVisible(false);
  }
Exemple #6
0
  private void loadMapUI(Group root) {
    Group editorUI = new Group();
    editorUI.setLayoutX(0);
    editorUI.setLayoutY(600);
    editorUI.setVisible(true);

    ToggleGroup tGroup = new ToggleGroup();

    ToggleButton tb1 = new ToggleButton("Ground");
    tb1.setLayoutX(0);
    tb1.setLayoutY(0);
    tb1.setId("Ground");
    ToggleButton tb2 = new ToggleButton("Forest");
    tb2.setLayoutX(70);
    tb2.setLayoutY(0);
    tb2.setId("Forest");
    ToggleButton tb3 = new ToggleButton("G Env");
    tb3.setLayoutX(140);
    tb3.setLayoutY(0);
    tb3.setId("GEnv");

    tb1.setToggleGroup(tGroup);
    tb2.setToggleGroup(tGroup);
    tb3.setToggleGroup(tGroup);

    tGroup.selectedToggleProperty().addListener(new Gui.Listener.EditorChangePaletteListener());
    tGroup.selectToggle(tb1);
    editorUI.getChildren().add(tb1);
    editorUI.getChildren().add(tb2);
    editorUI.getChildren().add(tb3);

    root.getChildren().add(editorUI);
  }
  @FXML
  protected void clear_tab(ActionEvent ae) {
    group.getChildren().clear();

    wrap_pane.getChildren().clear();
    label_box.getChildren().clear();

    wrap_pane = new HBox();
    label_box = new VBox();

    group.getChildren().add(wrap_pane);
    group.getChildren().add(label_box);

    mDataLabelToRow.clear();
    mRefLabelToRow.clear();

    mDataTables.clear();
    mRefDataTables.clear();

    mNextLabelIndex = 0;
    mNextRefLabelIndex = 0;
    mNextRun = 1;

    mLabelTable = null;
    mRefLabelTable = null;

    first = true;
  }
Exemple #8
0
  private void doesEatRegime() {
    if (isEnd) return;

    if (Math.abs(blocks.peekFirst().getX() - regimeRectangle.getX()) < 10
        && Math.abs(blocks.peekFirst().getY() - regimeRectangle.getY()) < 10
        && System.currentTimeMillis() - currentTime <= 10000) {

      regimeRectangle.setX(1200);
      isRegime = false;
      ++score;
      scoreLabel.setText(String.valueOf(score));

      blocks.pollLast();
      blocks.pollLast();
      blocks.pollLast();

      group.getChildren().remove(rectangles.peekLast());
      rectangles.pollLast();
      group.getChildren().remove(rectangles.peekLast());
      rectangles.pollLast();
      group.getChildren().remove(rectangles.peekLast());
      rectangles.pollLast();
    }

    if (System.currentTimeMillis() - currentTime > 10000) {
      regimeRectangle.setX(1200);
      isRegime = false;
    }
  }
Exemple #9
0
  /**
   * House
   *
   * @param listener
   * @return
   */
  private Group loadPaletteImg3(Gui.Listener.EditorChoosePaletteListener listener) {
    Group pGroup = new Group();
    pGroup.setVisible(false);
    pGroup.setLayoutX(0);
    pGroup.setLayoutY(650);

    ImageView ivBorder = new ImageView(Objekte.getImgMapEditor().getSingleBorder());
    listener.setBorder(ivBorder);

    ImageView ivGrasBunch01 = new Data.Overwrite.ImageView(Objekte.getImgMap().getGrasBunch01());
    listener.setId(2, 0, 201);
    ivGrasBunch01.setLayoutX(0);
    ImageView ivGrasBunch02 = new Data.Overwrite.ImageView(Objekte.getImgMap().getGrasBunch02());
    listener.setId(2, 1, 202);
    ivGrasBunch02.setLayoutX(25);
    ImageView ivGrasFlower01 = new Data.Overwrite.ImageView(Objekte.getImgMap().getGrasFlower01());
    listener.setId(2, 2, 203);
    ivGrasFlower01.setLayoutX(50);
    ImageView ivGrasFlowerBunch01 =
        new Data.Overwrite.ImageView(Objekte.getImgMap().getGrasFlowerBunch01());
    listener.setId(2, 3, 204);
    ivGrasFlowerBunch01.setLayoutX(75);

    ivGrasBunch01.setOnMouseClicked(listener);
    ivGrasBunch02.setOnMouseClicked(listener);
    ivGrasFlower01.setOnMouseClicked(listener);
    ivGrasFlowerBunch01.setOnMouseClicked(listener);
    pGroup.getChildren().add(ivGrasBunch01);
    pGroup.getChildren().add(ivGrasBunch02);
    pGroup.getChildren().add(ivGrasFlower01);
    pGroup.getChildren().add(ivGrasFlowerBunch01);
    pGroup.getChildren().add(ivBorder);
    return pGroup;
  }
Exemple #10
0
  @Override
  public void start(Stage primaryStage) throws Exception {
    Group root = new Group();
    Group circles = new Group();
    for (int i = 0; i < 30; i++) {
      Circle circle = new Circle(150, Color.web("white", 0.05));
      circle.setStrokeType(StrokeType.OUTSIDE);
      circle.setStroke(Color.web("white", 0.16));
      circle.setStrokeWidth(4);
      circles.getChildren().add(circle);
    }
    root.getChildren().add(circles);
    Scene scene = new Scene(root, 800, 600, Color.BLACK);
    Rectangle colors =
        new Rectangle(
            scene.getWidth(),
            scene.getHeight(),
            new LinearGradient(
                0f,
                1f,
                1f,
                0f,
                true,
                CycleMethod.NO_CYCLE,
                new Stop[] {
                  new Stop(0, Color.web("#f8bd55")),
                  new Stop(0.14, Color.web("#c0fe56")),
                  new Stop(0.28, Color.web("#5dfbc1")),
                  new Stop(0.43, Color.web("#64c2f8")),
                  new Stop(0.57, Color.web("#be4af7")),
                  new Stop(0.71, Color.web("#ed5fc2")),
                  new Stop(0.85, Color.web("#ef504c")),
                  new Stop(1, Color.web("#f2660f")),
                }));
    colors.widthProperty().bind(scene.widthProperty());
    colors.heightProperty().bind(scene.heightProperty());
    root.getChildren().add(colors);

    Timeline timeline = new Timeline();
    for (Node circle : circles.getChildren()) {
      timeline
          .getKeyFrames()
          .addAll(
              new KeyFrame(
                  Duration.ZERO, // set start position at 0
                  new KeyValue(circle.translateXProperty(), random() * 800),
                  new KeyValue(circle.translateYProperty(), random() * 600)),
              new KeyFrame(
                  new Duration(40000), // set end position at 40s
                  new KeyValue(circle.translateXProperty(), random() * 800),
                  new KeyValue(circle.translateYProperty(), random() * 600)));
    }
    timeline.play();
    primaryStage.setScene(scene);
    primaryStage.show();
  }
  @Override
  public Group scene3D() {
    Group group = new Group();

    String[] ac = {
        /* Our star   */
      "Soleil",
      /* Planets    */ "Mercure",
      "Venus",
      "Earth",
      "Mars",
      "Jupiter",
      "Saturne",
      "Uranus",
      "Neptune",
      /* Satellites */ "Moon",
      "Io",
      /* Others     */ "Pluton",
    };

    Planetoid[] astres = new Planetoid[ac.length];

    int i = 0;
    double x = 0.0, dx = 20.0;
    for (String planetoid : ac) {
      System.out.println(planetoid);

      AstralCorpseBean bean = new AstralCorpseBean();
      bean.load(MediaHelper.getURLForFile("/Solar System/" + planetoid + "/" + planetoid + ".ac"));
      bean.setRadius(10 /*bean.getRadius()*/);
      System.out.println(bean);

      final Planetoid corpse = new Planetoid(planetoid, bean.getRadius());
      PlanetoidEnlightment.setTexture(
          corpse, "Solar System/" + planetoid + "/" + planetoid + ".png");
      corpse.setTranslateX(x += dx);
      //			corpse.animate();
      astres[i++] = corpse;
    }

    Pivot p0 = new Pivot(0, 0, 0);
    Pivot p1 = new Pivot(100, 100, 100);

    AmbientLight ambient = new AmbientLight(Color.WHITE);

    //		PointLight light = new PointLight(Color.WHITE);
    //		p1.getChildren().add(light);

    group.getChildren().addAll(ambient);
    group.getChildren().addAll(astres);
    //		group.getChildren().addAll(new UniverseBox("redsky", 1e5));

    group.getChildren().addAll(buildAxes(p0, 10), buildAxes(p1, 50));

    return group;
  }
  private void addNewItemsDialog() {
    final Stage secondaryStage = new Stage();
    final Group grp = new Group();
    final Scene secondaryScene = new Scene(grp, 300, 200, Color.BISQUE);
    // ------------------------------------
    Font fnt = Font.font("Dialog", 0xc);

    Text nameTxt = new Text(30, 30, "Enter name of Cafe Item!");
    nameTxt.setFont(fnt);
    nameTxt.setFill(Color.DARKGRAY);
    grp.getChildren().add(nameTxt);

    final TextField nameField = new TextField();
    nameField.setLayoutX(30);
    nameField.setLayoutY(40);
    nameField.setMinWidth(240);
    nameField.setPromptText("Enter Name of Item");
    grp.getChildren().add(nameField);

    Text priceTxt = new Text(30, 90, "Enter price of Cafe Item! (NUMBER)");
    priceTxt.setFont(fnt);
    priceTxt.setFill(Color.DARKGRAY);
    grp.getChildren().add(priceTxt);

    final TextField priceField = new TextField();
    priceField.setLayoutX(30);
    priceField.setLayoutY(100);
    priceField.setMinWidth(240);
    priceField.setPromptText("Enter Price of Item (NUMBER)");
    grp.getChildren().add(priceField);

    Button saveButton = new Button("Save");
    saveButton.setLayoutX(230);
    saveButton.setLayoutY(170);
    saveButton.setDefaultButton(true);
    grp.getChildren().add(saveButton);
    saveButton.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent t) {
            CafePricingPersistence.addCafeItems(
                nameField.getText().toUpperCase(), priceField.getText());
            secondaryStage.close();
            new CafePricingDialog();
          }
        });

    // ------------------------------------
    secondaryStage.setScene(secondaryScene);
    secondaryStage.setResizable(false);
    secondaryStage.setTitle("Add Info");
    secondaryStage.show();
  }
Exemple #13
0
  private void reloadGame() {
    if (!isReload) return;

    score = 0;
    isReload = false;
    isEnd = false;
    feedCounter1 = 0;
    feedCounter2 = 0;

    List<Rectangle> rectangleList = new ArrayList<>(rectangles);
    for (Rectangle r : rectangleList) group.getChildren().remove(r);

    regimeRectangle.setX(-20);

    Deque<Block> blocksTemp = new ArrayDeque<>();
    Deque<Rectangle> rectanglesTemp = new ArrayDeque<>();

    head = new Block(100, 150);
    tale = new Block(90, 150);

    if (inputDirection != 3) {
      blocksTemp.push(tale);
      blocksTemp.push(head);

      rectanglesTemp.push(new Rectangle(tale.getX(), tale.getY(), 10, 10));
      rectanglesTemp.push(new Rectangle(head.getX(), head.getY(), 10, 10));
    } else {
      blocksTemp.push(head);
      blocksTemp.push(tale);

      rectanglesTemp.push(new Rectangle(head.getX(), head.getY(), 10, 10));
      rectanglesTemp.push(new Rectangle(tale.getX(), tale.getY(), 10, 10));
    }

    blocks = blocksTemp;
    rectangles = rectanglesTemp;

    group.getChildren().add(rectangles.getFirst());
    group.getChildren().add(rectangles.getLast());

    timer.cancel();
    timer = null;
    timer = new Timer();

    timer.schedule(
        new TimerTask() {
          @Override
          public void run() {
            Platform.runLater(() -> play());
          }
        },
        1,
        100);
  }
  public void start(Stage primaryStage) {
    primaryStage.setTitle("Lines");

    Group root = new Group();
    Scene scene = new Scene(root, 300, 150, Color.GRAY);

    Line redLine = new Line(10, 10, 200, 10);

    redLine.setStroke(Color.RED);
    redLine.setStrokeWidth(10);
    redLine.setStrokeLineCap(StrokeLineCap.BUTT);

    redLine.getStrokeDashArray().addAll(10d, 5d, 15d, 5d, 20d);
    redLine.setStrokeDashOffset(0);

    root.getChildren().add(redLine);

    Line whiteLine = new Line(10, 30, 200, 30);
    whiteLine.setStroke(Color.WHITE);
    whiteLine.setStrokeWidth(10);
    whiteLine.setStrokeLineCap(StrokeLineCap.ROUND);

    root.getChildren().add(whiteLine);

    Line blueLine = new Line(10, 50, 200, 50);
    blueLine.setStroke(Color.BLUE);
    blueLine.setStrokeWidth(10);

    root.getChildren().add(blueLine);

    Slider slider = new Slider(0, 100, 0);
    slider.setLayoutX(10);
    slider.setLayoutY(95);

    redLine.strokeDashOffsetProperty().bind(slider.valueProperty());

    root.getChildren().add(slider);

    Text offsetText = new Text("Stroke Dash Offset: 0.0");
    offsetText.setX(10);
    offsetText.setY(80);
    offsetText.setStroke(Color.WHITE);

    slider
        .valueProperty()
        .addListener(
            (ov, curVal, newVal) -> offsetText.setText("Stroke Dash Offset: " + slider.getValue()));
    root.getChildren().add(offsetText);
    primaryStage.setScene(scene);
    primaryStage.show();
  }
Exemple #15
0
  private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 600, 460));

    // Ellipse path example
    Rectangle rect = new Rectangle(0, 0, 40, 40);
    rect.setArcHeight(10);
    rect.setArcWidth(10);
    rect.setFill(Color.ORANGE);
    root.getChildren().add(rect);

    Path path = createEllipsePath(200, 200, 50, 100, 45);
    root.getChildren().add(path);

    pathTransitionEllipse =
        PathTransitionBuilder.create()
            .duration(Duration.seconds(4))
            .path(path)
            .node(rect)
            .orientation(OrientationType.NONE)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(false)
            .build();

    rect.setLayoutX(rect.getLayoutX() + rect.getLayoutBounds().getWidth() / 2);
    rect.setLayoutY(rect.getLayoutY() + rect.getLayoutBounds().getHeight() / 2);

    // Circle path example
    Rectangle rect2 = new Rectangle(0, 0, 20, 20);
    rect2.setArcHeight(10);
    rect2.setArcWidth(10);
    rect2.setFill(Color.GREEN);
    root.getChildren().add(rect2);

    Path path2 = createEllipsePath(400, 200, 150, 150, 0);
    root.getChildren().add(path2);

    pathTransitionCircle =
        PathTransitionBuilder.create()
            .duration(Duration.seconds(2))
            .path(path2)
            .node(rect2)
            .orientation(OrientationType.NONE)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(false)
            .build();

    rect2.setLayoutX(rect2.getLayoutX() + rect2.getLayoutBounds().getWidth() / 2);
    rect2.setLayoutY(rect2.getLayoutY() + rect2.getLayoutBounds().getHeight() / 2);
  }
    private Group createTickMarks() {
      Group group = new Group();

      for (int i = 0; i < numOfMarks; i++) {
        double angle = (360 / numOfMarks) * (i);
        group.getChildren().add(createTic(angle, radius / 10, 1.5));
      }

      for (int i = 0; i < numOfMinorMarks; i++) {
        double angle = (360 / numOfMinorMarks) * i;
        group.getChildren().add(createTic(angle, radius / 20, 1));
      }
      return group;
    }
Exemple #17
0
  private void updateGui() {
    if (isEnd) return;

    group.getChildren().remove(rectangles.peekLast());
    rectangles.pollLast();
    List<Rectangle> rectangleList = new ArrayList<>(rectangles);

    try {
      for (int i = 0; i < rectangleList.size() - 1; i++)
        group.getChildren().add(rectangleList.get(i));
    } catch (Exception e) {

    }
  }
  @Override
  public void start(Stage primaryStage) {
    primaryStage.setTitle("CoAP Explorer");
    Group root = new Group();
    Scene scene = new Scene(root, 800, 600);

    TextArea hexArea = new TextArea();
    TextArea binArea = new TextArea();

    CoapPacket packet = new CoapPacket();
    packet.setPayload("PAYLOAD");
    packetProp.setValue(packet);

    binArea.textProperty().bindBidirectional(packetProp, new AsciiConverter());

    hexArea.textProperty().bindBidirectional(packetProp, new HexConverter());
    hexArea.setEditable(false);
    hexArea.setFont(javafx.scene.text.Font.font(Font.MONOSPACED));

    VBox vbox = new VBox();
    vbox.setPadding(new Insets(10));
    vbox.setSpacing(8);

    VBox.setMargin(hexArea, new Insets(0, 0, 0, 8));
    vbox.getChildren().add(hexArea);
    VBox.setMargin(binArea, new Insets(0, 0, 0, 8));
    vbox.getChildren().add(binArea);

    root.getChildren().add(vbox);

    primaryStage.setScene(scene);
    primaryStage.show();
  }
  public void showMissions(final Stage stage) {
    root = new Group();
    int x = 100;
    int y = 100;

    try {
      FileInputStream fis = new FileInputStream("Missions.ifo");
      ObjectInputStream ois = new ObjectInputStream(fis);
      ArrayList<Mission> missions = (ArrayList<Mission>) ois.readObject();
      for (Mission i : missions) {
        if (!curClan.completed.contains(i)) {

          final Mission a = i;
          Button but = new Button(i.misName);
          but.setLayoutX(x);
          but.setLayoutY(y);
          y += 50;
          but.setOnAction(
              new EventHandler() {
                public void handle(Event e) {
                  m = a;
                  startMission(a, stage);
                }
              });
          root.getChildren().add(but);
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    scene = new Scene(root, 720, 600);
    stage.setScene(scene);
    stage.show();
  }
Exemple #20
0
  private Group createButtonArea(final Scene scene) {
    // create button area
    final Group buttonGroup = new Group();
    // rounded rect
    Rectangle buttonArea =
        RectangleBuilder.create()
            .arcWidth(15)
            .arcHeight(20)
            .fill(new Color(0, 0, 0, .55))
            .x(0)
            .y(0)
            .width(60)
            .height(30)
            .stroke(Color.rgb(255, 255, 255, .70))
            .build();
    buttonGroup.getChildren().add(buttonArea);

    // move button group when scene is resized
    buttonGroup
        .translateXProperty()
        .bind(scene.widthProperty().subtract(buttonArea.getWidth() + 6));
    buttonGroup
        .translateYProperty()
        .bind(scene.heightProperty().subtract(buttonArea.getHeight() + 6));
    return buttonGroup;
  }
Exemple #21
0
 private void init(Stage primaryStage) {
   Group root = new Group();
   primaryStage.setScene(new Scene(root, 310, 320));
   watch = new Watch();
   myLayout();
   root.getChildren().add(watch);
 }
Exemple #22
0
  @Override
  public void start(Stage primaryStage) throws Exception {

    ScreenContainer mainScreen = new ScreenContainer();

    // Adding the screens
    mainScreen.loadScreen("login", "/screens/client/login.fxml");
    mainScreen.loadScreen("main", "/screens/client/main.fxml");

    // Showing the main screen
    mainScreen.showScreen("login");
    primaryStage.setOnCloseRequest(
        event -> {
          mainScreen.closeScreen();
        });
    // Displaying the stage
    Group root = new Group();
    root.getChildren().addAll(mainScreen);
    Scene scene =
        new Scene(
            root); // , root.getLayoutBounds().getWidth(), root.getLayoutBounds().getHeight());
    primaryStage.setScene(scene);
    primaryStage.minHeightProperty().bind(mainScreen.heightProperty());
    primaryStage.minWidthProperty().bind(mainScreen.widthProperty());
    primaryStage.setTitle("Chat Client");
    primaryStage.show();
  }
  public InputDialog(final String title, final Object[] data) {
    initOwner(null);

    setTitle(title);

    if (0 != data.length % 2) {
      throw new IllegalArgumentException("Object data must be even!");
    }

    final Group root = new Group();
    final Scene scene = new Scene(root);
    setScene(scene);

    final GridPane gridpane = new GridPane();
    gridpane.setPadding(new Insets(5));
    gridpane.setHgap(5);
    gridpane.setVgap(5);

    for (int i = 0; i < data.length; i++) {
      if (0 == i % 2) {
        final Label label = new Label((String) data[i]);
        gridpane.add(label, 0, i / 2);
      } else {
        gridpane.add((Node) data[i], 1, (i - 1) / 2);
      }
    }

    gridpane.add(submit, 1, data.length / 2 + 1);
    GridPane.setHalignment(submit, HPos.RIGHT);
    root.getChildren().add(gridpane);
    sizeToScene();
    show();
  }
  /** DEFAULT. */
  public CafePricingDialog() {
    this.priceMap = new HashMap<>();
    this.primaryStage = new Stage();
    this.root = new Group();
    this.scrollPane = new ScrollPane();
    this.scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
    this.scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
    this.scene = new Scene(scrollPane, 0x190, 0x1f4, Color.LIGHTGREY);

    makeDialog(fp);

    fp.setMinSize(380, 480);
    fp.setAlignment(Pos.TOP_CENTER);

    bp.setTop(logoChildBP);
    bp.setCenter(labelChildBP);
    bp.setBottom(fp);

    root.getChildren().add(bp);

    scrollPane.setContent(root);

    // --------------------------------------------
    this.primaryStage.setTitle(TITLE);
    this.primaryStage.setScene(scene);
    this.primaryStage.setResizable(false);
    this.primaryStage.show();
  }
Exemple #25
0
  @Override
  public void start(Stage primaryStage) {
    try {
      Group root = new Group();
      Scene scene = new Scene(root, 400, 400);
      scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
      primaryStage.setScene(scene);
      primaryStage.show();

      final Rectangle rectBasicTimeline = new Rectangle();
      rectBasicTimeline.setX(0);
      rectBasicTimeline.setY(0);
      rectBasicTimeline.widthProperty().bind(scene.widthProperty());
      rectBasicTimeline.heightProperty().bind(scene.heightProperty());
      rectBasicTimeline.setFill(Color.RED);
      root.getChildren().add(rectBasicTimeline);
      final Timeline timeline = new Timeline();
      timeline.setCycleCount(Timeline.INDEFINITE);
      timeline.setAutoReverse(true);
      final KeyValue kv1 = new KeyValue(rectBasicTimeline.fillProperty(), Color.YELLOW);
      final KeyValue kv2 = new KeyValue(rectBasicTimeline.fillProperty(), Color.GREEN);
      final KeyValue kv3 = new KeyValue(rectBasicTimeline.fillProperty(), Color.BLUE);
      final KeyFrame kf1 = new KeyFrame(Duration.millis(5000), kv1);
      final KeyFrame kf2 = new KeyFrame(Duration.millis(10000), kv2);
      final KeyFrame kf3 = new KeyFrame(Duration.millis(15000), kv3);
      timeline.getKeyFrames().add(kf1);
      timeline.getKeyFrames().add(kf2);
      timeline.getKeyFrames().add(kf3);
      timeline.play();

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemple #26
0
  public void loadEditorPalette(Group root) {

    Gui.Listener.EditorChoosePaletteListener listener =
        new Gui.Listener.EditorChoosePaletteListener();

    Group pGroup1 = loadPaletteImg1(listener);
    Group pGroup2 = loadPaletteImg2(listener);
    Group pGroup3 = loadPaletteImg3(listener);

    Objekte.getMapEditorData().setPalettGroups(pGroup1, 0);
    Objekte.getMapEditorData().setPalettGroups(pGroup2, 1);
    Objekte.getMapEditorData().setPalettGroups(pGroup3, 2);
    root.getChildren().add(pGroup1);
    root.getChildren().add(pGroup2);
    root.getChildren().add(pGroup3);
  }
Exemple #27
0
  @Override
  public Group testObject3D() {
    Group group = new Group();

    TetrahedraMesh tetra = new TetrahedraMesh(10, 7, null);
    // cylinder = new PrismMesh(0.2,2,3); //,new Point3D(-5,5,0),new
    // Point3D(0,0,5));
    tetra.setDrawMode(DrawMode.LINE);
    tetra.setCullFace(CullFace.NONE);
    // NONE
    // cylinder.setTextureModeNone(Color.ROYALBLUE);
    // IMAGE
    // tetra.setTextureModeImage(getClass().getResource("res/steel-mesh.jpg").toExternalForm());
    // tetra.setTextureModeVertices1D(6, t->t);
    // cylinder.setColorPalette(ColorPalette.GREEN);
    // DENSITY
    tetra.setTextureModeVertices3D(1530, p -> p.magnitude());
    // cylinder.setTextureModeVertices3D(1530,p->(double)cylinder.unTransform(p).magnitude());
    // FACES
    // tetra.setTextureModeFaces(1530);

    group.getChildren().add(tetra);

    return group;
  }
  @Override
  public void start(Stage primaryStage) throws Exception {

    Button okBtn = new Button(Msg.get(this, "ok"));
    Button cancelBtn = new Button(Msg.get(this, "cancel"));

    // Set the location of the OK button
    okBtn.setLayoutX(10);
    cancelBtn.setLayoutY(10);

    // Set the location of the Cancel button relative to the OK button
    NumberBinding layoutXBinding = okBtn.layoutXProperty().add(okBtn.widthProperty().add(10));
    cancelBtn.layoutXProperty().bind(layoutXBinding);

    //
    cancelBtn.layoutYProperty().bind(okBtn.layoutYProperty());

    //
    Group root = new Group();
    root.getChildren().addAll(okBtn, cancelBtn);

    //
    Scene scene = new Scene(root);
    primaryStage.setScene(scene);
    primaryStage.setTitle(Msg.get(this, "title"));
    primaryStage.show();
  }
Exemple #29
0
  @Override
  public void start(Stage stage) throws Exception {
    this.primaryStage = stage;
    primaryStage.setTitle("Matrix Digital Rain");

    Group root = new Group();
    Scene scene = new Scene(root, 1024, 768);
    scene.addEventHandler(
        KeyEvent.KEY_PRESSED,
        new EventHandler<KeyEvent>() {
          @Override
          public void handle(KeyEvent keyEvent) {
            if (keyEvent.getCode() == KeyCode.F) {
              primaryStage.setFullScreen(!primaryStage.isFullScreen());
            }
            if (keyEvent.isControlDown() && keyEvent.getCode() == KeyCode.Q) {
              primaryStage.close();
            }
          }
        });

    Canvas canvas = new Canvas();
    canvas.widthProperty().bind(primaryStage.widthProperty());
    canvas.heightProperty().bind(primaryStage.heightProperty());

    final GraphicsContext gc = canvas.getGraphicsContext2D();
    gc.setFont(font);

    setupSimulation();

    new AnimationTimer() {
      @Override
      public void handle(long now) {
        update(now);

        gc.clearRect(0, 0, primaryStage.getWidth(), primaryStage.getHeight());
        gc.setFill(Color.rgb(0, 0, 1));
        gc.fillRect(0, 0, primaryStage.getWidth(), primaryStage.getHeight());

        int y = 0;
        int nbGlyphsPerRow = getNbGlyphsPerRow();
        int nbGlyphsPerColumn = getNbGlyphsPerColumn();

        for (int i = 0; i < nbGlyphsPerRow * nbGlyphsPerColumn; ++i) {
          gc.setFill(Color.rgb(0, path[i], 0));
          String text = String.valueOf(data[i]);
          gc.fillText(text, (i % nbGlyphsPerRow) * 12 + 1, y + 13);

          if (i % nbGlyphsPerRow == nbGlyphsPerRow - 1) {
            y += 12;
          }
        }
      }
    }.start();

    root.getChildren().add(canvas);

    primaryStage.setScene(scene);
    primaryStage.show();
  }
Exemple #30
0
  private void setTrollMessage() {
    switch (getScoreForTrolling()) {
      case Game.BAD_SCORE:
        {
          trollMessage.setText(Messages.NOT_GOOD + currentName);
          break;
        }
      case Game.CAN_BETTER_SCORE:
        {
          trollMessage.setText(Messages.YOU_CAN_BETTER + currentName);
          break;
        }
      case Game.NOT_BAD_SCORE:
        {
          trollMessage.setText(Messages.NOT_BAD + currentName);
          break;
        }
      case Game.AWESOME_SCORE:
        {
          trollMessage.setText(Messages.AWESOME + currentName);
          break;
        }
    }

    trollMessage.setTranslateX(90);
    trollMessage.setTranslateY(190);
    trollMessage.setFill(Color.WHITE);
    trollMessage.setTextAlignment(TextAlignment.CENTER);
    trollMessage.setFont(Font.loadFont(GameFiles.SENSEI, 24));

    gameOverBox.getChildren().remove(playerName);
    gameOverBox.getChildren().add(trollMessage);
    return;
  }