Example #1
2
  public static void message(String msg, StackPane pane) {

    Label warningL = new Label(msg);
    Labels.setLabelStyle(warningL, Custom.TEXT_SIZE_LARGER, true);
    warningL.setTextAlignment(TextAlignment.CENTER);

    StackPane warningPane = new StackPane();
    warningPane.getChildren().add(warningL);
    warningPane.setStyle(Custom.WINDOW_STYLING);
    warningPane.setMinWidth(Custom.SCREEN_WIDTH * 95 / 100);
    warningPane.setMaxWidth(Custom.SCREEN_WIDTH * 95 / 100);
    warningPane.setMinHeight(Custom.SCREEN_HEIGHT * 2 / 5);
    warningPane.setMaxHeight(Custom.SCREEN_HEIGHT * 2 / 5);
    warningPane.setBorder(
        new Border(
            new BorderStroke(
                Paint.valueOf("#000000"),
                BorderStrokeStyle.SOLID,
                new CornerRadii(30),
                new BorderWidths(5))));

    pane.getChildren().add(warningPane);

    PauseTransition pause = new PauseTransition(Duration.millis(1500));
    pause.setOnFinished(
        (f) -> {
          pane.getChildren().remove(warningPane);
          goBack();
        });
    pause.play();
  }
Example #2
1
  public static void setPayPane(int amount) {

    message = new Label(Custom.PAY_PTS_MESSAGE);
    Labels.setLabelStyle(message, Custom.TEXT_SIZE_LARGER, true);
    StackPane.setAlignment(message, Pos.CENTER);

    payBtn = new Button(Custom.YES);
    Buttons.setStoreLargerButtons(payBtn, true);
    StackPane.setAlignment(payBtn, Pos.BOTTOM_LEFT);
    payBtn.setOnAction((ae) -> PayPoints.buy(amount));

    backBtn = new Button(Custom.NO);
    Buttons.setStoreLargerButtons(backBtn, true);
    StackPane.setAlignment(backBtn, Pos.BOTTOM_RIGHT);
    backBtn.setOnAction((ae) -> PayPoints.goBack());

    mainPane = new StackPane();
    mainPane.setStyle(Custom.WINDOW_STYLING);
    mainPane.setMinWidth(Custom.SCREEN_WIDTH * 95 / 100);
    mainPane.setMaxWidth(Custom.SCREEN_WIDTH * 95 / 100);
    mainPane.setMinHeight(Custom.SCREEN_HEIGHT * 2 / 5);
    mainPane.setMaxHeight(Custom.SCREEN_HEIGHT * 2 / 5);
    mainPane.setBorder(
        new Border(
            new BorderStroke(
                Paint.valueOf("#000000"),
                BorderStrokeStyle.SOLID,
                new CornerRadii(30),
                new BorderWidths(5))));
    mainPane.getChildren().addAll(message, payBtn, backBtn);
    mainPane.setPadding(new Insets(10, 10, 10, 10));
    StackPane.setAlignment(mainPane, Pos.CENTER);

    backPane = new StackPane();
    backPane.getChildren().add(mainPane);
    backPane.setStyle(Custom.MENU_BACKGROUND);

    getRoot().getChildren().add(backPane);
  }
Example #3
0
 public void search() {
   try {
     ArrayList<Pair> searchQuery = indexer.searchResults(searchTextField.getText().split(" "));
     String URL = Indexer.docIdToURL(searchQuery.get(0).getKey().toString());
     searchTextField.setText(URL);
     label.setText("Status: FOUND PAGE");
     label.setTextFill(javafx.scene.paint.Paint.valueOf("Green"));
     webEngine.load(URL);
   } catch (Exception e) {
     label.setText("Status: NOTHING FOUND");
     label.setTextFill(javafx.scene.paint.Paint.valueOf("Red"));
   }
 }
 public void putDown(Philosopher chosenOne, String leftOrRight) throws InterruptedException {
   if (reentrantLock.isHeldByCurrentThread()) {
     reentrantLock.unlock();
     this.chopstickObject.setFill(Paint.valueOf("#28e7b2"));
     System.out.println(chosenOne + " put down " + leftOrRight + " chopstick");
     isAvailable = true;
   }
 }
Example #5
0
  public GridPane addGameZone() {

    GridPane grid = new GridPane();
    grid.setAlignment(Pos.TOP_LEFT);
    grid.setPadding(new Insets(0, 0, 0, 0));

    Integer rowPositioner = 0;
    Integer colPositioner = 0;

    for (int i = 0; i < 10; i++) {
      Rectangle rect = new Rectangle();
      rect.setHeight(10);
      rect.setWidth(10);
      rect.setFill(Paint.valueOf("white"));
      rect.setStroke(Paint.valueOf("black"));
      grid.add(rect, colPositioner, rowPositioner);

      rowPositioner++;
      colPositioner++;
    }

    return grid;
  }
Example #6
0
  // pokazuje wybran¹ playliste
  private void showCurrentPlaylist(File playlistFile) {
    flowPane.getChildren().clear();

    // ok³adka playlisty
    ImageView playlistCover =
        new ImageView(new Image(new File("temp_cover.png").toURI().toString()));
    playlistCover.setFitWidth(200);
    playlistCover.setPreserveRatio(true);
    playlistCover.setSmooth(true);
    // nazwa playlisty
    int ext = playlistFile.getName().lastIndexOf('.');
    Text playlistTitle = new Text(playlistFile.getName().substring(0, ext));
    playlistTitle.setFont(new Font("Segoe UI Light", 20));
    playlistTitle.setFill(Paint.valueOf("WHITE"));
    VBox playlistData = new VBox(playlistCover, playlistTitle);

    flowPane.getChildren().add(playlistData);
    loadSongs(Playlist.loadPlaylist(playlistFile));
  }
Example #7
0
  // pokazuje piosenki wybranego albumu
  private void showCurrentAlbum(Album album) {
    flowPane.getChildren().clear();

    Song tempSong = album.getSongs().get(0);
    // ok³adka albumu
    ImageView albumCover = new ImageView(tempSong.getAlbumCover());
    albumCover.imageProperty().bind(tempSong.albumCoverProperty());
    albumCover.setFitWidth(200);
    albumCover.setPreserveRatio(true);
    // tytu³ albumu
    Text albumTitle = new Text(tempSong.getAlbum());
    albumTitle.textProperty().bind(tempSong.albumProperty());
    albumTitle.setFont(new Font("Segoe UI Light", 20));
    albumTitle.setFill(Paint.valueOf("WHITE"));
    // VBox zawieraj¹cy ok³adkê i tytu³
    VBox albumData = new VBox(albumCover, albumTitle);
    flowPane.getChildren().addAll(albumData);

    loadSongs(album.getSongs());
  }
Example #8
0
  public GridPane build() {
    area = getNewGrid();

    for (int i = 0; i < eaTabs.size(); i++) {
      EATab eaTab = eaTabs.get(i);

      /*Label label = new Label(eaTab.getTabText() + "  Gen: 0");
      eaTab.fitnessGrapher.genHolder.addListener((val) -> {
      	label.setText(eaTab.getTabText() + "  Gen: " + (Integer)val);
      });*/

      final Label label = new Label(eaTab.getTabText() + "  Fit: --");
      eaTab.fitnessGrapher.fitHolder.addListener(
          (val) -> {
            label.setText(
                eaTab.getTabText() + "  Fit: " + (Math.round(((Double) val) * 100.0) / 100.0));
          });

      final Popup popup = new Popup();
      final Label popupMessage = new Label(label.getText());
      popupMessage.getStylesheets().add("./ui/css/style.css");
      popupMessage.getStyleClass().add("popup");

      label.setOnMouseEntered(
          event -> {
            popup.setAnchorX(event.getScreenX() + 20);
            popup.setAnchorY(event.getScreenY());
            popup.setAutoFix(true);
            popup.setHideOnEscape(true);
            popup.getContent().clear();
            popup.getContent().add(popupMessage);
            popup.show(GUI.stage);
          });

      label.setOnMouseExited(
          event -> {
            popup.hide();
          });

      Line line = new Line();
      line.setEndX(100);
      line.setStroke(Paint.valueOf("B4B4B4"));
      GridPane.setColumnSpan(line, 2);
      GridPane.setRowSpan(line, 1);
      GridPane.setHalignment(line, HPos.CENTER);
      GridPane.setValignment(line, VPos.CENTER);
      area.add(line, 0, i * 2 + 1);

      TetheredProgressBar progress = new TetheredProgressBar(eaTab.progressBar);

      StackPane sp = new StackPane();
      sp.getChildren().add(label);

      StackPane sp2 = new StackPane();
      sp2.getChildren().add(progress);

      VBox vbox = new VBox();
      vbox.getChildren().addAll(sp, sp2);

      HBox hbox = new HBox();

      TetheredButton button = new TetheredButton(eaTab.startButton);

      MenuButton mb = new MenuButton();
      mb.setText("...");
      MenuItem save = new MenuItem("Save");
      save.setOnAction(
          (event) -> {
            System.out.println("SAVE");
            fxController.saveEvolution(eaTab);
          });

      MenuItem close = new MenuItem("Close");
      close.setOnAction(
          (event) -> {
            fxController.closeTab(eaTab);
          });
      mb.getItems().addAll(save, close, new MenuItem("Send"));

      hbox.getChildren().addAll(button, mb);
      hbox.setSpacing(5);

      area.add(vbox, 0, i * 2);
      area.add(hbox, 1, i * 2);

      // button = null;
    }

    return area;
  }
Example #9
0
  public ResizeIcon(double _width, double _height) {
    width = new SimpleDoubleProperty();
    height = new SimpleDoubleProperty();

    width.set(_width);
    height.set(_height);

    isClicked = new SimpleBooleanProperty();
    isClicked.setValue(false);

    //		this.radiusProperty().set(5);
    //		this.setFill(javafx.scene.paint.Paint.valueOf("99CCFF"));

    //		this = new Polygon();
    this.getPoints().addAll(new Double[] {-5.0, 5.0, 5.0, -5.0, 5.0, 5.0});
    javafx.scene.paint.Paint tailColor = javafx.scene.paint.Paint.valueOf("000000");
    this.setFill(tailColor);

    // EventListener for MousePressed
    onMousePressedProperty()
        .set(
            new EventHandler<MouseEvent>() {

              public void handle(MouseEvent event) {
                // record the current mouse X and Y position on Node
                mouseX = event.getSceneX();
                mouseY = event.getSceneY();

                isClicked.setValue(true);
              }
            });

    // so the nodes does not move while we resize
    onMouseReleasedProperty()
        .set(
            new EventHandler<MouseEvent>() {

              public void handle(MouseEvent event) {
                isClicked.setValue(false);
              }
            });

    // Event Listener for MouseDragged
    onMouseDraggedProperty()
        .set(
            new EventHandler<MouseEvent>() {

              public void handle(MouseEvent event) {
                // calculate the new width and height
                double newWidth = width.getValue() + (event.getSceneX() - mouseX);
                double newHeight = height.getValue() + (event.getSceneY() - mouseY);

                width.setValue(newWidth);
                height.setValue(newHeight);

                // again set current Mouse x AND y position
                mouseX = event.getSceneX();
                mouseY = event.getSceneY();
                // }
              }
            });
  }
 public void pickUp(Philosopher chosenOne, String leftOrRight) throws InterruptedException {
   reentrantLock.lock();
   this.chopstickObject.setFill(Paint.valueOf("#8b282a"));
   System.out.println(chosenOne + " picked up " + leftOrRight + " chopstick");
   isAvailable = false;
 }
  @FXML
  private void archiveButtonClicked(ActionEvent event) {
    configureButtons();
    archiveButton.setGraphic(archiveSelectedIMV);

    // clear old content
    contentPane.getChildren().clear();

    // ask for archive date
    titleLabel.setText("Archiving");

    // create text and textfield
    VBox mainBox = new VBox();
    mainBox.setSpacing(20);
    mainBox.setAlignment(Pos.CENTER);

    HBox box = new HBox();
    contentPane.getChildren().add(mainBox);

    box.setSpacing(5);
    box.setAlignment(Pos.CENTER);

    Label dateLabel = new Label("Cut Off Date:");
    dateLabel.setFont(new Font("System", 24));

    TextField dateTF = new TextField();
    dateTF.setPromptText("YYYY-MM-DD");

    Label errorLabel = new Label();
    errorLabel.setTextFill(Paint.valueOf("#f5515f"));
    errorLabel.setFont(new Font("System", 14));

    Button confirmButton = new Button("Confirm");
    confirmButton.setStyle(
        "-fx-background-color: #e63347;" + "-fx-background-radius: 7;" + "-fx-text-fill: white");
    confirmButton.setPrefSize(130, 40);

    confirmButton.setOnAction(
        e -> {
          if (dateTF.getText() != null) {
            String cutoffDate = dateTF.getText().trim();
            if (cutoffDate.length() > 10) {
              errorLabel.setText("Too long");
              return;
            } else if (!isDate(cutoffDate)) {
              errorLabel.setText("Wrong date format");
              return;
            }

            boolean success = operation.archive(cutoffDate);
            if (success) {
              // set up content
              contentPane.getChildren().clear();

              TableView table = new TableView();
              TableColumn fnCol = new TableColumn("First Name");
              fnCol.setCellValueFactory(new PropertyValueFactory<>("firstName"));
              TableColumn lnCol = new TableColumn("Last Name");
              lnCol.setCellValueFactory(new PropertyValueFactory<>("lastName"));
              TableColumn emailCol = new TableColumn("Email");
              emailCol.setCellValueFactory(new PropertyValueFactory<>("email"));
              TableColumn lvCol = new TableColumn("Updated At");
              lvCol.setCellValueFactory(new PropertyValueFactory<>("updatedAt"));
              TableColumn discountCol = new TableColumn("Discount");
              discountCol.setCellValueFactory(new PropertyValueFactory<>("discount"));

              table.getColumns().addAll(fnCol, lnCol, emailCol, lvCol, discountCol);
              ObservableList<Customer> data =
                  FXCollections.observableArrayList(operation.getArchivedCustomers());
              table.setItems(data);

              contentPane.getChildren().add(table);

              titleLabel.setText("Archived Customers");

            } else {
              titleLabel.setText("Can't archive");
              return;
            }

          } else {
            errorLabel.setText("Please enter a date");
            return;
          }
        });

    box.getChildren().addAll(dateLabel, dateTF, errorLabel);
    mainBox.getChildren().addAll(box, confirmButton);
  }