public void init() {
    /*
    Image img1 = new Image(TermProjectMain.class.getResourceAsStream("bkash.png"));
    bkash.setImage(img1);
    Image img2 = new Image(TermProjectMain.class.getResourceAsStream("sure cash.png"));
    sureCash.setImage(img2);
    Image img3 = new Image(TermProjectMain.class.getResourceAsStream("dutch bangla.png"));
    DBBL.setImage(img3);
    Image img4 = new Image(TermProjectMain.class.getResourceAsStream("mastercard.png"));
    masterCard.setImage(img4);
    Image img5 = new Image(TermProjectMain.class.getResourceAsStream("visa.png"));
    visa.setImage(img5);
    */

    // fromBoxList.setAll(options);
    // toBoxList.setAll(options);
    // fromComboBox.getItems().addAll(fromBoxList);
    c = new clientInfo();

    fromComboBox.getItems().addAll(options);

    // toComboBox.getItems().addAll(toBoxList);
    toComboBox.getItems().addAll(options);

    fromComboBox.setVisibleRowCount(4);
    toComboBox.setVisibleRowCount(4);

    // the code fragment below ensures that no day before today is selected from the datePicker by
    // disabling the selecting option for those days and marking them in pink color
    final Callback<DatePicker, DateCell> dayCellFactory =
        new Callback<DatePicker, DateCell>() {
          @Override
          public DateCell call(final DatePicker datePicker) {
            return new DateCell() {
              @Override
              public void updateItem(LocalDate item, boolean empty) {
                super.updateItem(item, empty);

                if (item.isBefore(LocalDate.now())) {
                  setDisable(true);
                  setStyle("-fx-background-color: #ffc0cb;");
                }
              }
            };
          }
        };
    datePick.setDayCellFactory(dayCellFactory);
    datePick.setEditable(false);

    final ToggleGroup group = new ToggleGroup();
    ACradioButton.setToggleGroup(group);
    nonACradioButton.setToggleGroup(group);
  }
Exemplo n.º 2
0
  @Override
  protected void activate() {
    currencyComboBox.setItems(model.getTradeCurrencies());
    currencyComboBox.getSelectionModel().select(model.getTradeCurrency());
    currencyComboBox.setVisibleRowCount(Math.min(currencyComboBox.getItems().size(), 25));
    currencyComboBox.setOnAction(
        e -> {
          model.onSetTradeCurrency(currencyComboBox.getSelectionModel().getSelectedItem());
          updateChartData();
        });

    model.getOfferBookListItems().addListener(changeListener);
    tradeCurrencySubscriber =
        EasyBind.subscribe(
            model.tradeCurrency,
            newValue -> {
              String code = newValue.getCode();
              areaChart.setTitle("Offer book for " + newValue.getName());
              priceColumnLabel.set("Price (" + code + "/BTC)");
              volumeColumnLabel.set("Volume (" + code + ")");
              xAxis.setLabel(priceColumnLabel.get());
              xAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(xAxis, "", ""));
            });

    buyOfferTableView.setItems(model.getBuyOfferList());
    sellOfferTableView.setItems(model.getSellOfferList());

    updateChartData();
  }