Java Code Examples for javafx.scene.image.ImageView#setManaged()

The following examples show how to use javafx.scene.image.ImageView#setManaged() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnimatedTableRow.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
private ImageView createImageView(final TableRow<Person> row) {
	final Image image = row.snapshot(null, null);
	final ImageView imageView = new ImageView(image);
       // Manage image location ourselves (don't let layout manage it)
       imageView.setManaged(false);
	return imageView;
}
 
Example 2
Source File: LcdClockSkin.java    From Medusa with Apache License 2.0 4 votes vote down vote up
@Override protected void initGraphics() {
    // Set initial size
    if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) {
        if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) {
            clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight());
        } else {
            clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    mainInnerShadow0 = new InnerShadow();
    mainInnerShadow0.setOffsetX(0.0);
    mainInnerShadow0.setOffsetY(0.0);
    mainInnerShadow0.setRadius(3.0 / 132.0 * PREFERRED_WIDTH);
    mainInnerShadow0.setColor(Color.rgb(255, 255, 255, 0.5));
    mainInnerShadow0.setBlurType(BlurType.TWO_PASS_BOX);

    mainInnerShadow1 = new InnerShadow();
    mainInnerShadow1.setOffsetX(0.0);
    mainInnerShadow1.setOffsetY(1.0);
    mainInnerShadow1.setRadius(2.0 / 132.0 * PREFERRED_WIDTH);
    mainInnerShadow1.setColor(Color.rgb(0, 0, 0, 0.65));
    mainInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX);
    mainInnerShadow1.setInput(mainInnerShadow0);

    crystalClip = new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT);
    crystalClip.setArcWidth(5);
    crystalClip.setArcHeight(5);

    crystalImage   = Helper.createNoiseImage(PREFERRED_WIDTH, PREFERRED_HEIGHT, DARK_NOISE_COLOR, BRIGHT_NOISE_COLOR, 8);
    crystalOverlay = new ImageView(crystalImage);
    crystalOverlay.setClip(crystalClip);
    boolean crystalEnabled = clock.isLcdCrystalEnabled();
    crystalOverlay.setManaged(crystalEnabled);
    crystalOverlay.setVisible(crystalEnabled);

    boolean secondsVisible = clock.isSecondsVisible();

    backgroundTimeText = new Text("");
    backgroundTimeText.setFill(clock.getLcdDesign().lcdBackgroundColor);
    backgroundTimeText.setOpacity((LcdFont.LCD == clock.getLcdFont() || LcdFont.ELEKTRA == clock.getLcdFont()) ? 1 : 0);

    backgroundSecondText = new Text("");
    backgroundSecondText.setFill(clock.getLcdDesign().lcdBackgroundColor);
    backgroundSecondText.setOpacity((LcdFont.LCD == clock.getLcdFont() || LcdFont.ELEKTRA == clock.getLcdFont()) ? 1 : 0);
    backgroundSecondText.setManaged(secondsVisible);
    backgroundSecondText.setVisible(secondsVisible);

    timeText = new Text("");
    timeText.setFill(clock.getLcdDesign().lcdForegroundColor);

    secondText = new Text("");
    secondText.setFill(clock.getLcdDesign().lcdForegroundColor);
    secondText.setManaged(secondsVisible);
    secondText.setVisible(secondsVisible);

    title = new Text(clock.getTitle());
    title.setFill(clock.getLcdDesign().lcdForegroundColor);
    boolean titleVisible = clock.isTitleVisible();
    title.setManaged(titleVisible);
    title.setVisible(titleVisible);

    dateText = new Text(dateFormat.format(clock.getTime()));
    dateText.setFill(clock.getLcdDesign().lcdForegroundColor);
    boolean dateVisible = clock.isDateVisible();
    dateText.setManaged(dateVisible);
    dateText.setVisible(dateVisible);

    dayOfWeekText = new Text("");
    dayOfWeekText.setFill(clock.getLcdDesign().lcdForegroundColor);
    dayOfWeekText.setManaged(dateVisible);
    dayOfWeekText.setVisible(dateVisible);

    alarm = new Path();
    alarm.setFillRule(FillRule.EVEN_ODD);
    alarm.setStroke(null);
    boolean alarmVisible = clock.getAlarms().size() > 0;
    alarm.setManaged(alarmVisible);
    alarm.setVisible(alarmVisible);

    shadowGroup = new Group();
    shadowGroup.setEffect(clock.getShadowsEnabled() ? FOREGROUND_SHADOW : null);
    shadowGroup.getChildren().setAll(timeText,
                                     secondText,
                                     title,
                                     dateText,
                                     dayOfWeekText,
                                     alarm);

    pane = new Pane();
    pane.setEffect(clock.getShadowsEnabled() ? mainInnerShadow1 : null);
    pane.getChildren().setAll(crystalOverlay,
                              backgroundTimeText,
                              backgroundSecondText,
                              shadowGroup);
    getChildren().setAll(pane);
}
 
Example 3
Source File: DepositView.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void initialize() {

    paymentLabelString = Res.get("funds.deposit.fundBisqWallet");
    addressColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.address")));
    balanceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.balanceWithCur", Res.getBaseCurrencyCode())));
    confirmationsColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.confirmations")));
    usageColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.usage")));

    // trigger creation of at least 1 savings address
    walletService.getFreshAddressEntry();

    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    tableView.setPlaceholder(new AutoTooltipLabel(Res.get("funds.deposit.noAddresses")));
    tableViewSelectionListener = (observableValue, oldValue, newValue) -> {
        if (newValue != null) {
            fillForm(newValue.getAddressString());
            GUIUtil.requestFocus(amountTextField);
        }
    };

    setAddressColumnCellFactory();
    setBalanceColumnCellFactory();
    setUsageColumnCellFactory();
    setConfidenceColumnCellFactory();

    addressColumn.setComparator(Comparator.comparing(DepositListItem::getAddressString));
    balanceColumn.setComparator(Comparator.comparing(DepositListItem::getBalanceAsCoin));
    confirmationsColumn.setComparator(Comparator.comparingDouble(o -> o.getTxConfidenceIndicator().getProgress()));
    usageColumn.setComparator(Comparator.comparingInt(DepositListItem::getNumTxOutputs));
    tableView.getSortOrder().add(usageColumn);
    tableView.setItems(sortedList);

    titledGroupBg = addTitledGroupBg(gridPane, gridRow, 4, Res.get("funds.deposit.fundWallet"));
    titledGroupBg.getStyleClass().add("last");

    qrCodeImageView = new ImageView();
    qrCodeImageView.getStyleClass().add("qr-code");
    Tooltip.install(qrCodeImageView, new Tooltip(Res.get("shared.openLargeQRWindow")));
    qrCodeImageView.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(
            () -> UserThread.runAfter(
                    () -> new QRCodeWindow(getBitcoinURI()).show(),
                    200, TimeUnit.MILLISECONDS)));
    GridPane.setRowIndex(qrCodeImageView, gridRow);
    GridPane.setRowSpan(qrCodeImageView, 4);
    GridPane.setColumnIndex(qrCodeImageView, 1);
    GridPane.setMargin(qrCodeImageView, new Insets(Layout.FIRST_ROW_DISTANCE, 0, 0, 10));
    gridPane.getChildren().add(qrCodeImageView);

    addressTextField = addAddressTextField(gridPane, ++gridRow, Res.get("shared.address"), Layout.FIRST_ROW_DISTANCE);
    addressTextField.setPaymentLabel(paymentLabelString);


    amountTextField = addInputTextField(gridPane, ++gridRow, Res.get("funds.deposit.amount"));
    amountTextField.setMaxWidth(380);
    if (DevEnv.isDevMode())
        amountTextField.setText("10");

    titledGroupBg.setVisible(false);
    titledGroupBg.setManaged(false);
    qrCodeImageView.setVisible(false);
    qrCodeImageView.setManaged(false);
    addressTextField.setVisible(false);
    addressTextField.setManaged(false);
    amountTextField.setManaged(false);

    generateNewAddressButton = addButton(gridPane, ++gridRow, Res.get("funds.deposit.generateAddress"), -20);
    GridPane.setColumnIndex(generateNewAddressButton, 0);
    GridPane.setHalignment(generateNewAddressButton, HPos.LEFT);

    generateNewAddressButton.setOnAction(event -> {
        boolean hasUnUsedAddress = observableList.stream().anyMatch(e -> e.getNumTxOutputs() == 0);
        if (hasUnUsedAddress) {
            new Popup().warning(Res.get("funds.deposit.selectUnused")).show();
        } else {
            AddressEntry newSavingsAddressEntry = walletService.getFreshAddressEntry();
            updateList();
            observableList.stream()
                    .filter(depositListItem -> depositListItem.getAddressString().equals(newSavingsAddressEntry.getAddressString()))
                    .findAny()
                    .ifPresent(depositListItem -> tableView.getSelectionModel().select(depositListItem));
        }
    });

    balanceListener = new BalanceListener() {
        @Override
        public void onBalanceChanged(Coin balance, Transaction tx) {
            updateList();
        }
    };

    GUIUtil.focusWhenAddedToScene(amountTextField);
}