private TitledPane createTitledPane(CreditInfo creditInfo) {
    TitledPane titledPane = new TitledPane();
    titledPane.setText("Credit Info ID: " + creditInfo.getCreditInfoId());
    TextFlow textFlow = new TextFlow();
    Label creditInfoLabel = new Label(creditInfo.toString());
    creditInfoLabel.setWrapText(true);
    textFlow.getChildren().add(creditInfoLabel);
    titledPane.setContent(textFlow);

    return titledPane;
  }
Exemple #2
0
  public Parent createContent() {
    String family = "Helvetica";
    double size = 20;

    // Simple example
    textFlow = new TextFlow();
    textHello = new Text("Hello ");
    textHello.setFont(Font.font(family, size));
    textBold = new Text("Bold");
    textBold.setFont(Font.font(family, FontWeight.BOLD, size));
    textWorld = new Text(" World");
    textWorld.setFont(Font.font(family, FontPosture.ITALIC, size));
    textFlow.getChildren().addAll(textHello, textBold, textWorld);

    // Example with embedded objects
    TextFlow textFlowEmbedObj = new TextFlow();
    Text textEO1 = new Text("Lets have ");
    textEO1.setFont(Font.font(family, size));
    Text textEO2 = new Text("embedded objects: a Rectangle ");
    textEO2.setFont(Font.font(family, FontWeight.BOLD, size));
    Rectangle rect = new Rectangle(80, 60);
    rect.setFill(null);
    rect.setStroke(Color.GREEN);
    rect.setStrokeWidth(5);
    Text textEO3 = new Text(", then a button ");
    Button button = new Button("click me");
    Text textEO4 = new Text(", and finally an image ");
    ImageView imageView = new ImageView(image);
    Text textEO5 = new Text(".");
    textEO5.setFont(Font.font(family, size));

    textFlowEmbedObj
        .getChildren()
        .addAll(textEO1, textEO2, rect, textEO3, button, textEO4, imageView, textEO5);

    VBox vbox = new VBox(18);
    VBox.setMargin(textFlow, new Insets(5, 5, 0, 5));
    VBox.setMargin(textFlowEmbedObj, new Insets(0, 5, 5, 5));
    vbox.getChildren().addAll(textFlow, textFlowEmbedObj);

    return vbox;
  }
  @FXML
  private void initialize() throws Exception {
    assert rulesText != null
        : "fx:id=\"rulesText\" was not injected: check your FXML file 'RulesWindow.fxml'.";

    final String bodyText =
        new String(
            Files.readAllBytes(
                Paths.get(System.getProperty("user.dir") + "/bin/craps/controller/Rules.txt")));
    header.setUnderline(true);
    header.setText("Rules:\n");
    body.setText(bodyText);
    rulesText.getChildren().add(header);
    rulesText.getChildren().add(body);
  }
  private TitledPane createTitledPane(CreditRequest creditRequest) {
    TitledPane titledPane = new TitledPane();
    titledPane.setText("UserId: " + creditRequest.getUserId());
    VBox vBox = new VBox();
    TextFlow textFlow = new TextFlow();

    Label label = new Label(creditRequest.toString());
    label.setWrapText(true);
    textFlow.getChildren().add(label);

    textFlow.getChildren().add(new Label("Validate: "));
    CheckBox isValidCheckBox = new CheckBox();
    CheckBox rejectCheckBox = new CheckBox();

    isValidCheckBox
        .selectedProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              if (newValue == true) {
                rejectCheckBox.setSelected(false);
                creditRequest.setValidated(true);
              } else {
                creditRequest.setValidated(null);
              }
            });
    textFlow.getChildren().add(isValidCheckBox);

    textFlow.getChildren().add(new Label("Reject: "));
    rejectCheckBox
        .selectedProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              if (newValue == true) {
                isValidCheckBox.setSelected(false);
                creditRequest.setValidated(false);
              } else {
                creditRequest.setValidated(null);
              }
            });
    textFlow.getChildren().add(rejectCheckBox);

    Button creditHistoryButton = new Button("View Credit History");
    creditHistoryButton.setOnAction(
        e -> {
          session.setUserUnderValidationId(creditRequest.getUserId());
          screens.toCreditHistoryPage();
        });
    vBox.getChildren().add(textFlow);
    vBox.getChildren().add(creditHistoryButton);

    titledPane.setContent(vBox);

    return titledPane;
  }
Exemple #5
0
  public void initialize() {

    //        if (Objects.equals(System.getProperty("os.name"), "Mac OS X")){
    //
    //        }

    JSON json = new JSON();
    String[] result = json.returner();
    String name1 = result[3].replace(".zip", "");

    JCalPropertiesReader jCalPropertiesReader = new JCalPropertiesReader();
    String[] strings = jCalPropertiesReader.reader();

    new PropertiesWriter(name1, strings[5], result[1], result[2]);

    Text text1 = new Text(result[2]);
    text1.setFont(Font.font("Courier New", FontWeight.BOLD, 15));

    name.setFont(Font.font("", FontWeight.BOLD, 12));
    name.setText(name1);

    newVersion.setFont(Font.font("", FontWeight.BOLD, 12));
    newVersion.setText(result[1]);

    PropertiesReader propertiesReader = new PropertiesReader();
    String[] tempString = propertiesReader.reader();
    currentVersion.setText(tempString[1]);

    if (Objects.equals(result[1], tempString[1])) {
      Alert alert = new Alert(Alert.AlertType.INFORMATION);
      alert.setTitle("GUpdater");
      alert.setHeaderText("JCal up to date");
      alert.setContentText("Looks like your software is up to date");

      Optional<ButtonType> result1 = alert.showAndWait();
      if (result1.get() == ButtonType.OK) {
        Platform.exit();
      }
    }

    summary.getChildren().add(text1);

    close.setOnAction(event -> Platform.exit());

    update.setOnAction(
        event -> {
          Window ownerWindow = ((Node) event.getTarget()).getScene().getWindow();
          Stage stage = new Stage();
          stage.initStyle(StageStyle.UNDECORATED);
          stage.initModality(Modality.APPLICATION_MODAL);
          stage.initOwner(ownerWindow);
          Parent parent = null;
          try {
            parent = FXMLLoader.load(getClass().getResource("/resource/GUpdater-progress.fxml"));
          } catch (IOException e) {
            e.printStackTrace();
          }
          assert parent != null;
          Scene scene = new Scene(parent, 600, 148);
          stage.setResizable(false);
          stage.getIcons().add(new Image("/resource/g-4.png"));
          stage.setTitle("GUpdater");
          stage.setScene(scene);
          stage.show();
        });

    cancel.setOnAction(event -> Platform.exit());
  }
 /** The following method asserts the position properties of the test TestFx object */
 @Test
 public void testPosition() {
   assertNotNull(textFlow);
   assertEquals(textFlow.getLayoutX(), 80.0, 0);
   assertEquals(textFlow.getLayoutY(), 480.0, 0);
 }