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

The following examples show how to use javafx.scene.image.ImageView#setVisible() . 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: SuitStack.java    From Solitaire with GNU General Public License v2.0 7 votes vote down vote up
SuitStack(FoundationPile pIndex)
{
	aIndex = pIndex;
	setPadding(new Insets(PADDING));
	setStyle(BORDER_STYLE);
	final ImageView image = new ImageView(CardImages.getBack());
   	image.setVisible(false);
      	getChildren().add(image);
   	aDragHandler = new CardDragHandler(image);
   	image.setOnDragDetected(aDragHandler);
   	setOnDragOver(createOnDragOverHandler(image));
   	setOnDragEntered(createOnDragEnteredHandler());
   	setOnDragExited(createOnDragExitedHandler());
   	setOnDragDropped(createOnDragDroppedHandler());
   	GameModel.instance().addListener(this);
}
 
Example 2
Source File: GameModel.java    From JavaFX with MIT License 6 votes vote down vote up
public void reset() {
	getBoxesLeft().set(getInitialAmountBlocks());
	for (ImageView r : boxes) {
		r.setVisible(true);
	}
	setMovingSpeed(1.0);
	setMovingDown(true);
	setMovingRight(true);
	getBallX().setValue(250);
	getBallY().setValue(350);
	paddleX.setValue(175);
	gameStopped.set(true);
	getGameLost().set(false);
	getGameWon().set(false);
	setPaddleDragX(0.);
	setPaddleTranslateX(0.);
}
 
Example 3
Source File: Controller.java    From PoE_Level_Buddy with MIT License 5 votes vote down vote up
private void gemDisplayImageDispenser(ImageView imgview, Label txt, int n)
{
    ArrayList<QuestRewards> temp_quests = DataFactory.receiveQuests();
    txt.setText("\t\t\t" + temp_quests.get(n).get_reward().get(Settings.getINSTANCE().getSelectedGems()[n]).toString().replace("_", " "));
    txt.setTextFill(TEXT_HIGHLIGHT_COLOUR);
    txt.setVisible(true);
    imgview.setImage(new Image(getClass().getResource("gems/" + temp_quests.get(n).get_reward().get(Settings.getINSTANCE().getSelectedGems()[n]) + "_inventory_icon.png").toString()));
    imgview.setVisible(true);
}
 
Example 4
Source File: BallGameController.java    From JavaFX with MIT License 5 votes vote down vote up
/**
 * checks if the ball collides with one or more of the boxes. if there's a
 * collision, the box is removed.
 */
private void checkBoxCollisions() {
	for (ImageView r : model.getBoxes()) {
		if (r.isVisible() && ball.intersects(r.getBoundsInParent())) {
			model.getBoxesLeft().set(model.getBoxesLeft().get() - 1);
			r.setVisible(false);
		}
	}
}
 
Example 5
Source File: SingleClassNoXmlBallGame.java    From JavaFX with MIT License 5 votes vote down vote up
private void initGame() {
	boxesLeft.set(INITIAL_AMOUNT_BLOCKS);
	for (ImageView r : boxes) {
		r.setVisible(true);
	}
	movingSpeed = 1.0;
	movingDown = true;
	movingRight = true;
	ballX.setValue(250);
	ballY.setValue(350);
	paddleX.setValue(175);
	startButton.disableProperty().bind(gameStopped.not());
	ball.centerXProperty().bind(ballX);
	ball.centerYProperty().bind(ballY);
	paddle.xProperty().bind(paddleX);
	gameStopped.set(true);
	gameLost.set(false);
	gameOverText.visibleProperty().bind(gameLost);
	gameWon.set(false);
	winnerText.visibleProperty().bind(gameWon);
	area.requestFocus();
	progressBar.progressProperty().bind(
			boxesLeft.subtract(INITIAL_AMOUNT_BLOCKS).multiply(-1)
					.divide(INITIAL_AMOUNT_BLOCKS));
	remainingBlocksLabel.textProperty().bind(
			Bindings.format("%.0f boxes left", boxesLeft));
}
 
Example 6
Source File: SingleClassNoXmlBallGame.java    From JavaFX with MIT License 5 votes vote down vote up
private void checkBoxCollisions() {
	for (ImageView r : boxes) {
		if (r.isVisible() && ball.intersects(r.getBoundsInParent())) {
			boxesLeft.set(boxesLeft.get() - 1);
			r.setVisible(false);
		}
	}
}
 
Example 7
Source File: ViewText.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates the view.
 * @param sh The model.
 */
ViewText(final Text sh, final LaTeXDataService data) {
	super(sh);
	text = new javafx.scene.text.Text();
	compiledText = new ImageView();
	compileTooltip = new Tooltip(null);
	this.latexData = data;

	// Scaling at 0.5 as the png produced by latex is zoomed x 2 (for a better rendering)
	compiledText.setScaleX(0.5);
	compiledText.setScaleY(0.5);
	compiledText.setVisible(false);
	compiledText.setSmooth(true);
	compiledText.setCache(true);
	compiledText.imageProperty().addListener((observable, oldValue, theImg) -> {
		if(theImg != null) {
			// Have to move the picture as it is zoomed
			compiledText.setX(-theImg.getWidth() / 4d);
			compiledText.setY(-(3d * theImg.getHeight()) / 4d);
		}
	});

	textUpdate = (observable, oldValue, newValue) -> update();
	model.textProperty().addListener(textUpdate);

	getChildren().add(text);
	getChildren().add(compiledText);
	setImageTextEnable(false);
	update();
	bindTextPosition();
}
 
Example 8
Source File: DiscardPileView.java    From Solitaire with GNU General Public License v2.0 5 votes vote down vote up
DiscardPileView()
{
	setPadding(new Insets(PADDING));
   	final ImageView image = new ImageView(CardImages.getBack());
   	image.setVisible(false);
      	getChildren().add(image);
   	aDragHandler = new CardDragHandler(image);
   	image.setOnDragDetected(aDragHandler);
   	GameModel.instance().addListener(this);
}
 
Example 9
Source File: EightSegmentDisplay.java    From ARMStrong with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * creates a 8segment window
 * @param simulator the simulator
 */
public EightSegmentDisplay(ArmSimulator simulator){

    this.simulator = simulator;
    this.mainPane = new HBox();
    images = new ArrayList<>();
    segments = new ArrayList<>();


    
    for(int j = 0; j<15; j++) {
        VBox currentVBox = new VBox();
        this.mainPane.getChildren().add(currentVBox);
        AnchorPane imagesContainer = new AnchorPane();
        currentVBox.getChildren().add(imagesContainer);
        imagesContainer.getChildren().add(new ImageView(new Image(getClass().getResource("/resources/8_segment/8seg_base.png").toExternalForm())));
        images.add(new ArrayList<>());
        for (int i = 0; i < 8; i++) {
            ImageView currentImage = new ImageView(new Image(getClass().getResource("/resources/8_segment/8seg_" + (i + 1) + ".png").toExternalForm()));
            imagesContainer.getChildren().add(currentImage);
            images.get(j).add(currentImage);
            currentImage.setVisible(false);
        }
        segments.add(simulator.newIO8Segment());
        currentVBox.getChildren().add(new Text("0x" + Long.toHexString(segments.get(j).getSegment(0).getPortAddress())));
    }

    this.dockNode = new DockNode(mainPane, "8 segment view");
    dockNode.setPrefSize(460,666);

}
 
Example 10
Source File: Controller.java    From PoE_Level_Buddy with MIT License 5 votes vote down vote up
/**
 * Hides the options when pressed.
 */
public void optionsArrow(MouseEvent mouseEvent)
{
    if (mouseEvent.getSource() instanceof ImageView)
    {
        ImageView imgView = (ImageView) mouseEvent.getSource();

        if (mouseEvent.getEventType().equals(MouseEvent.MOUSE_ENTERED))
        {
            imgView.setImage(new Image(getClass().getResource("ico/collapse0_hl.png").toString()));
        }
        else if (mouseEvent.getEventType().equals(MouseEvent.MOUSE_EXITED))
        {
            imgView.setImage(new Image(getClass().getResource("ico/collapse0.png").toString()));
        }
        else if (mouseEvent.getEventType().equals(MouseEvent.MOUSE_CLICKED))
        {
            Settings.getINSTANCE().setBandits(comboBoxThatIsSelected());
            Settings.getINSTANCE().saveData();
            optionsAnchorPane.setVisible(false);
            optionsAnchorPaneMenu.setVisible(false);
            gemSelectorAnchorPane.setVisible(false);
            for (ImageView i : actArray)
                i.setVisible(false);
            inOptions = false;
            HelperZonePane.setVisible(true);
        }
    }
}
 
Example 11
Source File: Controller.java    From PoE_Level_Buddy with MIT License 5 votes vote down vote up
private void hideSelectors()
{
    for (RadioButton r : radioButtons)
    {
        r.setVisible(false);
        r.setSelected(false);
    }
    for (ImageView i : gemIcons)
        i.setVisible(false);
}
 
Example 12
Source File: ScheduleListNode.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
public ScheduleListNode(Displayable displayable) {
    super(10);
    setAlignment(Pos.CENTER_LEFT);
    ImageView icon = displayable.getPreviewIcon();
    liveIcon = new ImageView(new Image("file:icons/recordingssettingsicon.png"));
    liveIcon.setFitHeight(10);
    liveIcon.setFitWidth(10);
    liveIcon.setVisible(false);
    getChildren().add(icon);
    getChildren().add(new Label(displayable.getPreviewText()));
    getChildren().add(liveIcon);

    if (displayable instanceof TextDisplayable || displayable instanceof TimerDisplayable) {
        themeButton = new Button("", new ImageView(new Image("file:icons/theme.png", 16, 16, false, true)));
        if (displayable instanceof TextDisplayable) {
            themeButton.setOnAction(new EditThemeScheduleActionHandler((TextDisplayable) displayable));
        } else {
            themeButton.setOnAction(new EditTimerThemeActionHandler((TimerDisplayable) displayable));
        }
        Utils.setToolbarButtonStyle(themeButton);
        Region spacer = new Region();
        HBox.setHgrow(spacer, Priority.ALWAYS);
        getChildren().add(spacer);
        getChildren().add(themeButton);
        themeButton.setOpacity(0);
        fade = new FadeTransition(Duration.millis(100), themeButton);
        setOnMouseEntered((event) -> {
            fade.stop();
            fade.setToValue(1);
            fade.play();
        });
        setOnMouseExited((event) -> {
            fade.stop();
            fade.setToValue(0);
            fade.play();
        });
    }
}
 
Example 13
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 14
Source File: Splash.java    From netbeans with Apache License 2.0 4 votes vote down vote up
Splash() {
    state = STATE_SHOW_TITLE;
    stateArg = 0;
    initTimeline();
    background = new ImageView();
    background.setFocusTraversable(true);
    background.setImage(Config.getImages().get(Config.IMAGE_BACKGROUND));
    background.setFitWidth(Config.SCREEN_WIDTH);
    background.setFitHeight(Config.SCREEN_HEIGHT);
    background.setOnMousePressed(new EventHandler<MouseEvent>() {
        public void handle(MouseEvent me) {
            Main.getMainFrame().startGame();
        }
    });
    background.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            Main.getMainFrame().startGame();
        }
    });
    brick = new ImageView();
    brick.setImage(Config.getImages().get(Config.IMAGE_SPLASH_BRICK));
    brick.setTranslateX(-1000);
    brick.setTranslateY(brick.getImage().getHeight());
    brickShadow = new ImageView();
    brickShadow.setImage(Config.getImages().get(Config.IMAGE_SPLASH_BRICKSHADOW));
    brickShadow.setTranslateX(-1000);
    breaker = new ImageView();
    breaker.setImage(Config.getImages().get(Config.IMAGE_SPLASH_BREAKER));
    breaker.setTranslateX(-1000);
    breaker.setTranslateY(brick.getTranslateY() + brick.getImage().getHeight() * 5 / 4);
    breakerShadow = new ImageView();
    breakerShadow.setImage(Config.getImages().get(Config.IMAGE_SPLASH_BREAKERSHADOW));
    breakerShadow.setTranslateX(-1000);
    strike = new ImageView();
    strike.setImage(Config.getImages().get(Config.IMAGE_SPLASH_STRIKE));
    strike.setTranslateY(brick.getTranslateY() -
        (strike.getImage().getHeight() - brick.getImage().getHeight()) / 2);
    strike.setVisible(false);
    pressanykey = new ImageView();
    pressanykey.setImage(Config.getImages().get(Config.IMAGE_SPLASH_PRESSANYKEY));
    pressanykey.setTranslateX((Config.SCREEN_WIDTH - pressanykey.getImage().getWidth()) / 2);
    double y = breaker.getTranslateY() + breaker.getImage().getHeight();
    pressanykey.setTranslateY(y + (Config.SCREEN_HEIGHT - y) / 2);
    pressanykey.setOpacity(0);
    strikeShadow = new ImageView();
    strikeShadow.setImage(Config.getImages().get(Config.IMAGE_SPLASH_STRIKESHADOW));
    strikeShadow.setTranslateX(-1000);
    pressanykeyShadow = new ImageView();
    pressanykeyShadow.setImage(Config.getImages().get(Config.IMAGE_SPLASH_PRESSANYKEYSHADOW));
    pressanykeyShadow.setTranslateX(-1000);
    sun = new ImageView();
    sun.setImage(Config.getImages().get(Config.IMAGE_SPLASH_SUN));
    sun.setTranslateX(-1000);
    NODES = new ImageView[] {brick, breaker, strike, pressanykey};
    NODES_SHADOWS = new ImageView[] {brickShadow, breakerShadow, strikeShadow, pressanykeyShadow};
    Group group = new Group();
    group.getChildren().add(background);
    group.getChildren().addAll(NODES_SHADOWS);
    group.getChildren().addAll(NODES);
    group.getChildren().add(sun);
    getChildren().add(group);
}
 
Example 15
Source File: Splash.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
Splash() {
    state = STATE_SHOW_TITLE;
    stateArg = 0;
    initTimeline();
    background = new ImageView();
    background.setFocusTraversable(true);
    background.setImage(Config.getImages().get(Config.IMAGE_BACKGROUND));
    background.setFitWidth(Config.SCREEN_WIDTH);
    background.setFitHeight(Config.SCREEN_HEIGHT);
    background.setOnMousePressed(new EventHandler<MouseEvent>() {
        public void handle(MouseEvent me) {
            Main.getMainFrame().startGame();
        }
    });
    background.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            Main.getMainFrame().startGame();
        }
    });
    brick = new ImageView();
    brick.setImage(Config.getImages().get(Config.IMAGE_SPLASH_BRICK));
    brick.setTranslateX(-1000);
    brick.setTranslateY(brick.getImage().getHeight());
    brickShadow = new ImageView();
    brickShadow.setImage(Config.getImages().get(Config.IMAGE_SPLASH_BRICKSHADOW));
    brickShadow.setTranslateX(-1000);
    breaker = new ImageView();
    breaker.setImage(Config.getImages().get(Config.IMAGE_SPLASH_BREAKER));
    breaker.setTranslateX(-1000);
    breaker.setTranslateY(brick.getTranslateY() + brick.getImage().getHeight() * 5 / 4);
    breakerShadow = new ImageView();
    breakerShadow.setImage(Config.getImages().get(Config.IMAGE_SPLASH_BREAKERSHADOW));
    breakerShadow.setTranslateX(-1000);
    strike = new ImageView();
    strike.setImage(Config.getImages().get(Config.IMAGE_SPLASH_STRIKE));
    strike.setTranslateY(brick.getTranslateY() -
        (strike.getImage().getHeight() - brick.getImage().getHeight()) / 2);
    strike.setVisible(false);
    pressanykey = new ImageView();
    pressanykey.setImage(Config.getImages().get(Config.IMAGE_SPLASH_PRESSANYKEY));
    pressanykey.setTranslateX((Config.SCREEN_WIDTH - pressanykey.getImage().getWidth()) / 2);
    double y = breaker.getTranslateY() + breaker.getImage().getHeight();
    pressanykey.setTranslateY(y + (Config.SCREEN_HEIGHT - y) / 2);
    pressanykey.setOpacity(0);
    strikeShadow = new ImageView();
    strikeShadow.setImage(Config.getImages().get(Config.IMAGE_SPLASH_STRIKESHADOW));
    strikeShadow.setTranslateX(-1000);
    pressanykeyShadow = new ImageView();
    pressanykeyShadow.setImage(Config.getImages().get(Config.IMAGE_SPLASH_PRESSANYKEYSHADOW));
    pressanykeyShadow.setTranslateX(-1000);
    sun = new ImageView();
    sun.setImage(Config.getImages().get(Config.IMAGE_SPLASH_SUN));
    sun.setTranslateX(-1000);
    NODES = new ImageView[] {brick, breaker, strike, pressanykey};
    NODES_SHADOWS = new ImageView[] {brickShadow, breakerShadow, strikeShadow, pressanykeyShadow};
    Group group = new Group();
    group.getChildren().add(background);
    group.getChildren().addAll(NODES_SHADOWS);
    group.getChildren().addAll(NODES);
    group.getChildren().add(sun);
    getChildren().add(group);
}
 
Example 16
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);
}
 
Example 17
Source File: Splash.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
Splash() {
    state = STATE_SHOW_TITLE;
    stateArg = 0;
    initTimeline();
    background = new ImageView();
    background.setFocusTraversable(true);
    background.setImage(Config.getImages().get(Config.IMAGE_BACKGROUND));
    background.setFitWidth(Config.SCREEN_WIDTH);
    background.setFitHeight(Config.SCREEN_HEIGHT);
    background.setOnMousePressed(new EventHandler<MouseEvent>() {
        public void handle(MouseEvent me) {
            Main.getMainFrame().startGame();
        }
    });
    background.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            Main.getMainFrame().startGame();
        }
    });
    brick = new ImageView();
    brick.setImage(Config.getImages().get(Config.IMAGE_SPLASH_BRICK));
    brick.setTranslateX(-1000);
    brick.setTranslateY(brick.getImage().getHeight());
    brickShadow = new ImageView();
    brickShadow.setImage(Config.getImages().get(Config.IMAGE_SPLASH_BRICKSHADOW));
    brickShadow.setTranslateX(-1000);
    breaker = new ImageView();
    breaker.setImage(Config.getImages().get(Config.IMAGE_SPLASH_BREAKER));
    breaker.setTranslateX(-1000);
    breaker.setTranslateY(brick.getTranslateY() + brick.getImage().getHeight() * 5 / 4);
    breakerShadow = new ImageView();
    breakerShadow.setImage(Config.getImages().get(Config.IMAGE_SPLASH_BREAKERSHADOW));
    breakerShadow.setTranslateX(-1000);
    strike = new ImageView();
    strike.setImage(Config.getImages().get(Config.IMAGE_SPLASH_STRIKE));
    strike.setTranslateY(brick.getTranslateY() -
        (strike.getImage().getHeight() - brick.getImage().getHeight()) / 2);
    strike.setVisible(false);
    pressanykey = new ImageView();
    pressanykey.setImage(Config.getImages().get(Config.IMAGE_SPLASH_PRESSANYKEY));
    pressanykey.setTranslateX((Config.SCREEN_WIDTH - pressanykey.getImage().getWidth()) / 2);
    double y = breaker.getTranslateY() + breaker.getImage().getHeight();
    pressanykey.setTranslateY(y + (Config.SCREEN_HEIGHT - y) / 2);
    pressanykey.setOpacity(0);
    strikeShadow = new ImageView();
    strikeShadow.setImage(Config.getImages().get(Config.IMAGE_SPLASH_STRIKESHADOW));
    strikeShadow.setTranslateX(-1000);
    pressanykeyShadow = new ImageView();
    pressanykeyShadow.setImage(Config.getImages().get(Config.IMAGE_SPLASH_PRESSANYKEYSHADOW));
    pressanykeyShadow.setTranslateX(-1000);
    sun = new ImageView();
    sun.setImage(Config.getImages().get(Config.IMAGE_SPLASH_SUN));
    sun.setTranslateX(-1000);
    NODES = new ImageView[] {brick, breaker, strike, pressanykey};
    NODES_SHADOWS = new ImageView[] {brickShadow, breakerShadow, strikeShadow, pressanykeyShadow};
    Group group = new Group();
    group.getChildren().add(background);
    group.getChildren().addAll(NODES_SHADOWS);
    group.getChildren().addAll(NODES);
    group.getChildren().add(sun);
    getChildren().add(group);
}