private static void layoutizeLabelCreator(
      ICreatorCustomLabel myLabel, double r, double g, double b) {
    Color color = Color.color(r, g, b);
    ((Label) myLabel)
        .setBackground(
            new Background(new BackgroundFill(color, new CornerRadii(3), new Insets(0))));
    ((Label) myLabel).setStyle("-fx-border-color: white;");
    ((Label) myLabel).setMinSize(400, 35);
    ((Label) myLabel).setTextAlignment(TextAlignment.CENTER);
    ((Label) myLabel).setFont(Font.font(20));
    ((Label) myLabel)
        .setOnDragDetected(
            new EventHandler<MouseEvent>() {
              @Override
              public void handle(MouseEvent event) {
                Dragboard db = ((Label) event.getSource()).startDragAndDrop(TransferMode.ANY);

                ClipboardContent content = new ClipboardContent();
                content.putString("clipboardString");
                db.setContent(content);

                event.consume();
              }
            });
    ((Label) myLabel).setVisible(true);
  }
  protected HBox buildPiePageAlumno() {

    HBox hBox = new HBox();
    hBox.setMaxHeight(maxHeightPie);
    hBox.setMaxWidth(DefaultAncho);
    hBox.setStyle("-fx-background-color: Black");

    HBox agrupacion = new HBox();

    agrupacion
        .getChildren()
        .addAll(
            TextBuilder.create()
                .text("|   ")
                .font(Font.font("MS UI Gothic", FontWeight.BOLD, FontPosture.REGULAR, 20))
                .fill(Color.WHITE)
                .build(),
            txtRecienLlegados,
            TextBuilder.create()
                .text("   |")
                .font(Font.font("MS UI Gothic", FontWeight.BOLD, FontPosture.REGULAR, 20))
                .fill(Color.WHITE)
                .build());

    hBox.getChildren().addAll(imgpieImagen, agrupacion);
    HBox.setMargin(imgpieImagen, new Insets(0, 0, 0, 10));
    HBox.setMargin(agrupacion, new Insets(10, 0, 10, 770));
    return hBox;
  }
  private void buildObjetos() {

    // imagen goindex
    imgIndex = buildButton("index.png", 60, 60, true);

    // filtro autor
    txtFiltroAutor =
        TextBuilder.create()
            .text("Por Autor")
            .cursor(Cursor.HAND)
            .fill(Color.WHITE)
            .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28))
            .build();

    // filtro titulo
    txtFiltroTitulo =
        TextBuilder.create()
            .text("Por Título")
            .cursor(Cursor.HAND)
            .fill(Color.WHITE)
            .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28))
            .build();

    // filtro materia
    txtFiltroEditorial =
        TextBuilder.create()
            .text("Por Editorial")
            .cursor(Cursor.HAND)
            .fill(Color.WHITE)
            .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28))
            .build();

    // ver Ranking
    txtRanking =
        TextBuilder.create()
            .text("Ranking")
            .cursor(Cursor.HAND)
            .fill(Color.WHITE)
            .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28))
            .build();

    // pie de p�gina
    imgpieImagen =
        ImageViewBuilder.create()
            .image(new Image(getClass().getResourceAsStream("Imagenes/imagenPie.png")))
            .preserveRatio(true)
            .fitHeight(40)
            .build();
    // label de recien LLegados
    txtRecienLlegados =
        TextBuilder.create()
            .text("Recien Llegados")
            .font(Font.font("MS UI Gothic", FontWeight.BOLD, 20))
            .fill(Color.WHITE)
            .cursor(Cursor.HAND)
            .effect(BloomBuilder.create().threshold(0f).build())
            .build();
  }
  private void setCaracteristicasAlContenedorPrincipal() {

    Button botonJuegosExistentes = new Button("Juegos existentes");
    botonJuegosExistentes.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    botonJuegosExistentes.setTextFill(Color.WHITE);

    BackgroundFill fondoDeColorJuegosExistentes =
        new BackgroundFill(Color.RED, new CornerRadii(5), new Insets(0.0, 0.0, 0.0, 0.0));
    botonJuegosExistentes.setBackground(new Background(fondoDeColorJuegosExistentes));

    botonJuegosExistentes.setOnMouseEntered(
        e -> {
          botonJuegosExistentes.setScaleX(1.3);
          botonJuegosExistentes.setScaleY(1.3);
        });

    botonJuegosExistentes.setOnMouseExited(
        e -> {
          botonJuegosExistentes.setScaleX(1);
          botonJuegosExistentes.setScaleY(1);
        });

    botonJuegosExistentes.setOnAction(
        e -> {
          VistaJuegosExistentes nuevaVista = new VistaJuegosExistentes(this);
          nuevaVista.mostrar();
        });

    Button botonNuevoJuego = new Button("Nuevo juego");
    botonNuevoJuego.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    botonNuevoJuego.setTextFill(Color.WHITE);

    BackgroundFill fondoDeColorNuevoJuego =
        new BackgroundFill(Color.RED, new CornerRadii(5), new Insets(0.0, 0.0, 0.0, 0.0));
    botonNuevoJuego.setBackground(new Background(fondoDeColorNuevoJuego));

    botonNuevoJuego.setOnMouseEntered(
        e -> {
          botonNuevoJuego.setScaleX(1.3);
          botonNuevoJuego.setScaleY(1.3);
        });

    botonNuevoJuego.setOnMouseExited(
        e -> {
          botonNuevoJuego.setScaleX(1);
          botonNuevoJuego.setScaleY(1);
        });

    botonNuevoJuego.setOnAction(
        e -> {
          VistaEleccionVarianteFlor nuevaVista = new VistaEleccionVarianteFlor(this);
          nuevaVista.mostrar();
        });

    this.contenedor.getChildren().addAll(botonJuegosExistentes, botonNuevoJuego);
  }
  protected Node buildtoolsFiltroAlumno(boolean index) {

    HBox hBox = new HBox(10);
    hBox.setMaxHeight(maxHeightCabezera);
    hBox.setMaxWidth(DefaultAncho);
    hBox.setMinWidth(DefaultAncho);
    hBox.setPadding(new Insets(10, 10, 5, 10));
    hBox.setStyle("-fx-background-color:black");

    hBox.getChildren().add(txtFiltroTitulo);
    hBox.getChildren()
        .add(
            TextBuilder.create()
                .text("|")
                .fill(Color.WHITE)
                .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28))
                .build());
    hBox.getChildren().add(txtFiltroAutor);
    hBox.getChildren()
        .add(
            TextBuilder.create()
                .text("|")
                .fill(Color.WHITE)
                .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28))
                .build());
    hBox.getChildren().add(txtFiltroEditorial);
    hBox.getChildren()
        .add(
            TextBuilder.create()
                .text("|")
                .fill(Color.WHITE)
                .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28))
                .build());
    hBox.getChildren().add(txtRanking);
    hBox.getChildren()
        .add(
            TextBuilder.create()
                .text("|")
                .fill(Color.WHITE)
                .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28))
                .build());
    // Agregando el Efecto Bloom
    Bloom bloom = BloomBuilder.create().threshold(0f).build();
    hBox.setEffect(bloom);

    if (index) {
      StackPane agrupador = new StackPane();
      agrupador.getChildren().add(hBox);
      agrupador.getChildren().add(imgIndex);
      StackPane.setAlignment(imgIndex, Pos.BOTTOM_RIGHT);
      StackPane.setMargin(imgIndex, new Insets(0, -6, -17, 0));
      return agrupador;
    } else {
      return hBox;
    }
  }
  public void initContent(GridPane pane) {
    // pane.setGridLinesVisible(true);
    pane.setPadding(new Insets(20));
    pane.setHgap(10);
    pane.setVgap(20);

    // header label
    Label lblHeader = new Label("Alert Dialogs");
    pane.add(lblHeader, 1, 0);
    lblHeader.setTextFill(Color.DARKBLUE);
    lblHeader.setFont(Font.font("Calibri", FontWeight.BOLD, 36));

    // label for input text field
    Label lblInput = new Label("A Text field:");
    pane.add(lblInput, 0, 1);
    lblInput.setFont(Font.font("Calibri", FontWeight.NORMAL, 20));

    // input text field
    this.txfInput = new TextField();
    pane.add(txfInput, 1, 1);
    this.txfInput.setMinHeight(30.0);
    this.txfInput.setPromptText("Enter some text and save.");

    // horizontal box for buttons
    HBox hbox = new HBox(20);
    pane.add(hbox, 1, 2);
    hbox.setAlignment(Pos.CENTER);

    // info button
    Button btnInfo = new Button("Info");
    btnInfo.setOnAction(event -> this.infoAction());
    hbox.getChildren().add(btnInfo);

    // save button
    Button btnSave = new Button("Save");
    btnSave.setOnAction(event -> this.saveAction());
    hbox.getChildren().add(btnSave);

    // clear button
    Button btnClear = new Button("Clear");
    btnClear.setOnAction(event -> this.clearAction());
    hbox.getChildren().add(btnClear);

    // status text
    this.txtStatus = new Text();
    pane.add(txtStatus, 0, 4, 3, 1);
    this.txtStatus.setFont(Font.font("Calibri", FontWeight.NORMAL, 20));
    this.txtStatus.setFill(Color.FIREBRICK);
    this.txtStatus.setText("An example of Alert Dialogs. Enter some text and save.");

    btnInfo.requestFocus();
  }
  private void addStaticContent() {
    createLegend();

    final Text inputText = new Text("Input");
    inputText.setX(
        getAnimationPaneWidth() / 2
            - getAnimationPaneWidth() / 4
            - inputText.getBoundsInLocal().getWidth() / 2);
    inputText.setY(20);
    inputText.setFont(
        Font.font(Font.getDefault().getName(), FontWeight.BOLD, Font.getDefault().getSize()));
    inputText.setFontSmoothingType(FontSmoothingType.LCD);
    animationPane.getChildren().add(inputText);

    final Text outputText = new Text("Output");
    outputText.setX(
        getAnimationPaneWidth() / 2
            + getAnimationPaneWidth() / 4
            - outputText.getBoundsInLocal().getWidth() / 2);
    outputText.setY(20);
    outputText.setFont(
        Font.font(Font.getDefault().getName(), FontWeight.BOLD, Font.getDefault().getSize()));
    outputText.setFontSmoothingType(FontSmoothingType.LCD);
    animationPane.getChildren().add(outputText);

    final Text adapterText = new Text("Adapter");
    adapterText.setX(getAnimationPaneWidth() / 2 - adapterText.getBoundsInLocal().getWidth() / 2);
    adapterText.setTranslateY(20);
    adapterText.setFont(
        Font.font(Font.getDefault().getName(), FontWeight.BOLD, Font.getDefault().getSize()));
    adapterText.setFontSmoothingType(FontSmoothingType.LCD);
    animationPane.getChildren().add(adapterText);

    Line lineInput = new Line();
    lineInput.getStrokeDashArray().addAll(5d);
    lineInput.setCache(true);
    lineInput.startXProperty().set(getAnimationPaneWidth() / 2 - getAnimationPaneWidth() / 8);
    lineInput.endXProperty().set(lineInput.startXProperty().get());
    lineInput.startYProperty().set(0);
    lineInput.endYProperty().bind(animationPane.heightProperty());
    animationPane.getChildren().add(lineInput);

    Line lineOutput = new Line();
    lineOutput.getStrokeDashArray().addAll(5d);
    lineOutput.setCache(true);
    lineOutput.startXProperty().set(getAnimationPaneWidth() / 2 + getAnimationPaneWidth() / 8);
    lineOutput.endXProperty().set(lineOutput.startXProperty().get());
    lineOutput.startYProperty().set(0);
    lineOutput.endYProperty().bind(animationPane.heightProperty());
    animationPane.getChildren().add(lineOutput);
  }
  public void createAppointmentsView(User user, AppointmentViewController parentController) {

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

    HBox hbox = new HBox();
    hbox.setSpacing(10);

    Text title = new Text("Appoinments");
    title.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    hbox.getChildren().add(title);

    Button mainMenuBtn = new Button("Main Menu");
    mainMenuBtn.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent e) {
            parentController.goBack();
          }
        });
    hbox.getChildren().add(mainMenuBtn);
    vbox.getChildren().add(hbox);

    // Show schedule appointment if patient or HSP staff
    if (user.getUsertype() == UserType.PATIENT || user.getUsertype() == UserType.HSPSTAFF) {

      vbox.getChildren().add(addScheduleAppoinment(null, parentController));
    }

    Text subTitle = new Text("Manage/View Appoinments");
    title.setFont(Font.font("Tahoma", FontWeight.NORMAL, 15));
    vbox.getChildren().add(subTitle);

    listView = new ListView<String>();
    listView.setItems(parentController.getAppoinmentList());
    listView
        .getSelectionModel()
        .selectedItemProperty()
        .addListener(
            (ObservableValue<? extends String> observable, String oldValue, String newValue) -> {
              System.out.println(newValue);
              int index = listView.getSelectionModel().getSelectedIndex();
              parentController.didSelectItem(index);
            });
    vbox.getChildren().add(listView);
    createScene(vbox);
  }
Beispiel #9
0
 private void createShowConsoleButton() {
   consoleToggleButton = new ToggleButton(FontAwesome.ICON_TERMINAL);
   consoleToggleButton.setFont(Font.font("FontAwesome", 14));
   consoleToggleButton.setTextFill(Color.DARKBLUE);
   consoleToggleButton.setTooltip(new Tooltip("Show/Hide Console."));
   consoleToggleButton.selectedProperty().bindBidirectional(isDetailNodeVisible);
 }
Beispiel #10
0
 private void createProxyRequestsButton() {
   proxyRequestsToggleButton = new ToggleButton(FontAwesome.ICON_EXCHANGE);
   proxyRequestsToggleButton.setFont(Font.font("FontAwesome", 14));
   proxyRequestsToggleButton.setTextFill(Color.BLACK);
   proxyRequestsToggleButton.setTooltip(new Tooltip("Enable/Disable Proxying via Burp"));
   proxyRequestsToggleButton.selectedProperty().bindBidirectional(isProxyingEnabled);
 }
Beispiel #11
0
 private void createShowAlertsButton() {
   showAlertsToggleButton = new ToggleButton(FontAwesome.ICON_WARNING);
   showAlertsToggleButton.setFont(Font.font("FontAwesome", 14));
   showAlertsToggleButton.setTextFill(Color.DARKGOLDENROD);
   showAlertsToggleButton.setTooltip(new Tooltip("Show/Hide Alerts."));
   showAlertsToggleButton.selectedProperty().bindBidirectional(showAlerts);
 }
Beispiel #12
0
 public HexPane(FileHex hex) {
   super(hex.getHexText());
   this.hex = hex;
   setEditable(false);
   // http://stackoverflow.com/questions/24983841/format-text-output-in-javafx
   setFont(Font.font("Courier New", 14));
 }
 private Text drawText(double x, double y, String text, Color color) {
   Text t = new Text(x, y, text);
   t.setFill(color);
   t.setFont(Font.font("Tahoma", 20));
   t.setTextAlignment(TextAlignment.CENTER);
   return t;
 }
Beispiel #14
0
  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;
  }
  @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();
  }
  /** @param fp */
  private void makeDialog(FlowPane fp) {

    Separator sp = new Separator();

    // LOGO
    logoChildBP.setCenter(logo);

    // LBL TXT
    lblText = new Text(LBLTXT);
    Font mFont = Font.font("Dialog", FontPosture.ITALIC, 0xf);
    lblText.setFont(mFont);
    lblText.setFill(Color.BLUEVIOLET);
    lblText.setWrappingWidth(0x12c);
    labelChildBP.setCenter(lblText);

    // ----------------------------------------------------------------------
    addItems(fp);
    // ----------------------------------------------------------------------
    this.addButt = new Button("ADD NEW");
    this.addButt.setDefaultButton(true);
    this.addButt.setAlignment(Pos.TOP_RIGHT);
    this.addButt.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent t) {
            addNewItemsDialog();
            primaryStage.close();
          }
        });
    fp.getChildren().add(addButt);
  }
 public void setResults(BenchmarkResult results) {
   double p = (double) results.score / 100;
   double marginalError = (1.96 * Math.sqrt((p * (1 - p)) / results.signatures.size())) * 100;
   pctLabel.setText(
       results.score
           + "% \u00B1 "
           + Math.round(marginalError)
           + "% ("
           + results.matched
           + "/"
           + results.signatures.size()
           + ")");
   for (SignatureResult result : results.signatures) {
     if (result.matched) {
       Label lbl =
           new Label(
               ""
                   + String.format(
                       "0x%06X -> 0x%06X", result.sourcePosition, result.matchedPosition)
                   + result.toString());
       lbl.setFont(Font.font("monospace"));
       resultList.getItems().add(lbl);
     }
   }
 }
  public void createUpdateAppoinmentView(
      Appointment appointment, AppointmentViewController parentController) {
    VBox vbox = new VBox();
    vbox.setPadding(new Insets(25));
    vbox.setSpacing(8);

    HBox hbox = new HBox();
    hbox.setSpacing(10);

    Text title = new Text("Update Appoinment");
    title.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    hbox.getChildren().add(title);

    Button mainMenuBtn = new Button("Go Back");
    mainMenuBtn.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent e) {
            parentController.handleUpdateGoBack();
          }
        });
    hbox.getChildren().add(mainMenuBtn);
    vbox.getChildren().add(hbox);

    vbox.getChildren().add(addScheduleAppoinment(appointment, parentController));
    createScene(vbox);
  }
  public void showEDResult(List<String> path) {
    // intialize alert/dialog to display edit distance result
    Alert alert = new Alert(AlertType.INFORMATION);
    alert.setTitle("Result");
    alert.setHeaderText("Word Path : ");
    alert.initModality(Modality.NONE);
    alert.setResizable(true);

    // create layout for content
    VBox box = new VBox();
    HBox midBox = new HBox();
    box.setPadding(new Insets(35, 0, 35, 0));
    box.setSpacing(35);
    midBox.setSpacing(15);

    Label pathLabel = new Label();
    Label numStepsLabel = new Label("Number of steps : ");
    Label numSteps = new Label();
    Font font = new Font(14);
    pathLabel.setFont(font);
    numStepsLabel.setFont(font);
    numSteps.setFont(Font.font(font.getFamily(), FontWeight.BOLD, 14));

    midBox.getChildren().add(numStepsLabel);
    midBox.getChildren().add(numSteps);
    midBox.setAlignment(Pos.CENTER);

    box.getChildren().add(pathLabel);
    box.getChildren().add(midBox);
    box.setAlignment(Pos.CENTER);
    alert.getDialogPane().setPrefWidth(300);

    // check for path
    if (path != null) {
      numSteps.setText(Integer.toString(path.size() - 1));
      pathLabel.setText(String.join(" -> ", path));

      Text text = new Text(pathLabel.getText());
      text.setFont(font);
      if (text.getLayoutBounds().getWidth() > 200) {
        alert.getDialogPane().setPrefWidth(text.getLayoutBounds().getWidth() + 100);
      }

    }
    // no path found
    else {
      pathLabel.setText("No Path Found.");
      numSteps.setText("N/A");
    }

    // set content and styling
    alert.getDialogPane().setContent(box);
    alert
        .getDialogPane()
        .getStylesheets()
        .add(getClass().getResource("application.css").toExternalForm());
    alert.getDialogPane().getStyleClass().add("myDialog");
    alert.showAndWait();
  }
Beispiel #20
0
 private void createFirebugButton() {
   firebugButton = new Button(FontAwesome.ICON_BUG);
   firebugButton.setFont(Font.font("FontAwesome", 14));
   firebugButton.setTextFill(Color.RED);
   firebugButton.setTooltip(new Tooltip("Launch Firebug."));
   firebugButton.disableProperty().bind(webEngine.getLoadWorker().runningProperty());
   firebugButton.setOnAction(observable -> webEngine.executeScript(firebugScript));
 }
 private static Parent setTitle(String str) {
   final VBox vbox = new VBox();
   final Text text = new Text(str);
   text.setFont(Font.font("Times New Roman", 24));
   text.setFill(Color.WHEAT);
   vbox.getChildren().add(text);
   return vbox;
 }
Beispiel #22
0
  /** Constructor to create to access the GridPane created for adding organizations. */
  public QuestionnaireAdd() {

    // PaneController.addMap(TITLE, this);

    // GridPane gp = new GridPane();

    label = new Label("Create a New Questionnaire");
    label.setFont(Font.font("Verdana", FontWeight.BOLD, 18));
  }
 public Church(Main.Location loc) {
   super(CHURCH, loc);
   Label label = new Label();
   label.textProperty().bind(mealsServed.asString());
   label.setFont(Font.font("Impact", 12 * Main.SCALE));
   label.setTranslateX(-8 * Main.SCALE);
   label.setTranslateY(3 * Main.SCALE);
   getChildren().add(label);
 }
Beispiel #24
0
 private HBox createLabelBox() {
   Text label = new Text("E-Bazaar");
   label.setFont(Font.font("Comic Sans MS", FontWeight.BOLD, 60));
   label.setFill(Color.DARKRED);
   HBox labelBox = new HBox(10);
   labelBox.setAlignment(Pos.CENTER);
   labelBox.getChildren().add(label);
   return labelBox;
 }
Beispiel #25
0
  @Override
  protected void initUI() {
    Text scoreText = new Text();
    scoreText.setFont(Font.font(18));
    scoreText.setTranslateX(1100);
    scoreText.setTranslateY(50);
    scoreText.textProperty().bind(score.asString("Score: %d"));

    getGameScene().addUINode(scoreText);
  }
  public void start(Stage primaryStage) {

    // Creates the pane and font objects to be used, as well as a string for the chars.
    Pane paneOne = new Pane();
    Font mainFont = Font.font("Times New Roman", FontWeight.BOLD, FontPosture.REGULAR, 35);
    String text = "Welcome to Java ";

    // Makes a point in the very center of the 600x600 scene, a double for distance
    // from the center, and one for the starting rotation of the first character.
    double centerX = 300;
    double centerY = 300;
    double distance = 200;
    double rotation = 90;

    for (int i = 0; i < text.length(); i++) {
      /**
       * To make the positions work correctly, I treat the characters as elements on a unit circle.
       * I find the angle by multiplying 2 * pi by i, then dividing that by the length of the text.
       * Next, I find the A. cos and B. sin of the angle, and multiply that by the distance from the
       * center to find the change in X and Y respectively. Finally, the X and Y for the current
       * character are found by adding the change in X and Y to the center X and Y.
       */
      double unitCircleAngle = (2 * Math.PI * i) / text.length();
      double deltaX = distance * Math.cos(unitCircleAngle);
      double deltaY = distance * Math.sin(unitCircleAngle);
      double currentX = centerX + deltaX;
      double currentY = centerY + deltaY;

      // I make a string of the char at index i by finding the charAt, then using the
      // Character.toString
      // method to cast it a string; then I make a Text object using the current X and Y and the
      // current
      // character. I set the font, and current rotation of the character. Finally, I add 22.5 to
      // the rotation
      // to ensure that it is at the appropriate rotation for the next character.
      String tempChar = Character.toString(text.charAt(i));
      ;
      Text tempText = new Text(currentX, currentY, tempChar);

      tempText.setFont(mainFont);
      tempText.setRotate(rotation);

      paneOne.getChildren().add(tempText);
      rotation = rotation + 22.5;
    }

    // I make a scene of the appropriate size using the pane with the characters, set the stage
    // title, add the
    // scene to the stage, and show it.
    Scene sceneOne = new Scene(paneOne, 600, 600);
    primaryStage.setTitle("Characters Around A Circle");
    primaryStage.setScene(sceneOne);
    primaryStage.show();
  }
  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();
  }
Beispiel #28
0
  @Override
  public void start(Stage stage) {
    // Create a Shadow of a Text node
    Text t1 = new Text("Shadow");
    t1.setFont(Font.font(36));
    t1.setEffect(new Shadow());

    // Create a Glow effect using a Shadow
    Text t2Original = new Text("Glow");
    t2Original.setFont(Font.font(36));
    Text t2 = new Text("Glow");
    t2.setFont(Font.font(36));
    Shadow s2 = new Shadow();
    s2.setColor(Color.YELLOW);
    t2.setEffect(s2);
    StackPane glow = new StackPane(t2Original, t2);

    // Create a DropShadow effect using a Shadow
    Text t3Original = new Text("DropShadow");
    t3Original.setFont(Font.font(36));
    Text t3 = new Text("DropShadow");
    t3.setFont(Font.font(36));
    Shadow s3 = new Shadow();
    t3.setEffect(s3);
    StackPane dropShadow = new StackPane(t3, t3Original);

    HBox root = new HBox(t1, glow, dropShadow);
    root.setSpacing(20);
    root.setStyle(
        "-fx-padding: 10;"
            + "-fx-border-style: solid inside;"
            + "-fx-border-width: 2;"
            + "-fx-border-insets: 5;"
            + "-fx-border-radius: 5;"
            + "-fx-border-color: blue;");

    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("Using Shadow Effect");
    stage.show();
  }
Beispiel #29
0
  @FXML
  protected void initialize() {
    super.initialize();

    undoableController.setUndoRedo(sudoku);
    undoableController.setUpdate(this);
    persistableController.setStateStore(sudoku);
    persistableController.setUpdate(this);

    Font assignableFont = Font.font("Courier", 40);
    Font notAssignableFont = Font.font("Arial", 28);
    Color invalid = Color.RED;
    Color normal = Color.BLACK;
    Color selected = Color.WHITE;

    for (int i = 1; i <= ISudoku.BOARD_SIZE; i++) {
      imageGrid.setImage(
          CELL_ASSIGNABLE_INDICATOR + CELL_SELECTED_INDICATOR + i,
          createTextImage(i, assignableFont, Color.BLACK, selected));
      imageGrid.setImage(
          CELL_SELECTED_INDICATOR + i, createTextImage(i, notAssignableFont, Color.BLACK, normal));

      imageGrid.setImage(
          CELL_ASSIGNABLE_INDICATOR + CELL_INVALID_INDICATOR + i,
          createTextImage(i, assignableFont, Color.BLACK, invalid));
      imageGrid.setImage(
          CELL_INVALID_INDICATOR + i, createTextImage(i, notAssignableFont, Color.BLACK, invalid));

      imageGrid.setImage(
          CELL_ASSIGNABLE_INDICATOR + i, createTextImage(i, assignableFont, Color.BLACK, normal));
      imageGrid.setImage(
          Integer.toString(i), createTextImage(i, notAssignableFont, Color.BLACK, normal));
    }

    imageGrid.setImage(
        CELL_ASSIGNABLE_INDICATOR + CELL_SELECTED_INDICATOR,
        createTextImage("|", assignableFont, Color.BLACK, Color.WHITE));

    imageGrid.setCellColors(1, "#F2F2F2");
    imageGrid.setStyle("-fx-background-color: #6E6E6E;");
  }
  public LoadViewPane() {
    addListeners();

    Reflection reflection = new Reflection();

    text.setStyle("-fx-text-fill: FF8A00;");
    text.setLayoutY(40);
    text.setFont(Font.font("Iowan Old Style", 70));
    text.setEffect(reflection);

    getChildren().add(text);
  }