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

The following examples show how to use javafx.scene.image.ImageView#setId() . 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: Story.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
/** @return the content of the address, with a signature and portrait attached. */
private Pane getContent() {
  final VBox content = new VBox();
  content.getStyleClass().add("address");

  //int rand = RandomUtil.getRandomInt(1);

  final Label address = new Label(START1+START2+MID1+MID2+MID3+MID4);

  address.setWrapText(true);
  ScrollPane addressScroll = makeScrollable(address);

  final ImageView signature = new ImageView(); signature.setId("signature");
  final ImageView lincolnImage = new ImageView(); lincolnImage.setId("portrait");
  VBox.setVgrow(addressScroll, Priority.ALWAYS);

  final Region spring = new Region();
  HBox.setHgrow(spring, Priority.ALWAYS);
  
  //final Node alignedSignature = HBoxBuilder.create().children(spring, signature).build();
  final HBox alignedSignature = new HBox(spring, signature);
  
  Label date = new Label(DATE);
  date.setAlignment(Pos.BOTTOM_RIGHT);

  content.getChildren().addAll(
      lincolnImage,
      addressScroll,
      alignedSignature,
      date
  );

  return content;
}
 
Example 2
Source File: TestLoadImageUsingClass.java    From javafxsvg with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected Parent getRootNode() {
	InputStream imageData = this.getClass().getClassLoader()
			.getResourceAsStream("bacon.svg");

	Image image = new Image(imageData);
	ImageView imageView = new ImageView(image);
	imageView.setId("TestImage");

	return new AnchorPane(imageView);
}
 
Example 3
Source File: DaoLaunchWindow.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void createContent() {
    HBox slidingContentWithPagingBox = new HBox();
    slidingContentWithPagingBox.setPadding(new Insets(30, 0, 0, 0));
    slidingContentWithPagingBox.setAlignment(Pos.CENTER);
    Button prevButton = getIconButton(MaterialDesignIcon.ARROW_LEFT, "dao-launch-paging-button");
    prevButton.setOnAction(event -> {
        autoPlayTimeline.stop();
        goToPrevSection();
    });
    Button nextButton = getIconButton(MaterialDesignIcon.ARROW_RIGHT, "dao-launch-paging-button");
    nextButton.setOnAction(event -> {
        autoPlayTimeline.stop();
        goToNextSection();
    });
    VBox slidingContent = new VBox();
    slidingContent.setMinWidth(616);
    slidingContent.setSpacing(20);
    sectionDescriptionLabel = new Label();
    sectionDescriptionLabel.setTextAlignment(TextAlignment.CENTER);
    sectionDescriptionLabel.getStyleClass().add("dao-launch-description");
    sectionDescriptionLabel.setMaxWidth(562);
    sectionDescriptionLabel.setWrapText(true);


    selectedSection = sections.get(currentSectionIndex.get());

    sectionDescriptionLabel.setText(selectedSection.description);
    sectionScreenshot = new ImageView();
    sectionScreenshot.setOpacity(0);
    sectionScreenshot.setId(selectedSection.imageId);

    slidingContent.setAlignment(Pos.CENTER);
    slidingContent.getChildren().addAll(sectionDescriptionLabel, sectionScreenshot);
    slidingContentWithPagingBox.getChildren().addAll(prevButton, slidingContent, nextButton);

    GridPane.setRowIndex(slidingContentWithPagingBox, ++rowIndex);
    GridPane.setColumnSpan(slidingContentWithPagingBox, 2);
    GridPane.setHgrow(slidingContent, Priority.ALWAYS);
    gridPane.getChildren().add(slidingContentWithPagingBox);
}
 
Example 4
Source File: NewTradeProtocolLaunchWindow.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
@NotNull
private VBox getFeatureBox(String title, String description, String imageId, String url) {
    Label featureTitle = new Label(title);
    featureTitle.setTextAlignment(TextAlignment.LEFT);
    featureTitle.getStyleClass().add("news-feature-headline");

    ImageView sectionScreenshot = new ImageView();
    sectionScreenshot.setId(imageId);

    HBox imageContainer = new HBox(sectionScreenshot);
    imageContainer.getStyleClass().add("news-feature-image");

    Label featureDescription = new Label(description);
    featureDescription.setTextAlignment(TextAlignment.LEFT);
    featureDescription.getStyleClass().add("news-feature-description");
    featureDescription.setWrapText(true);

    HyperlinkWithIcon learnMore = new ExternalHyperlink(Res.get("shared.learnMore"), "highlight");
    learnMore.setOnAction(event -> {

        if (DontShowAgainLookup.showAgain(GUIUtil.OPEN_WEB_PAGE_KEY)) {
            hide();
            GUIUtil.openWebPage(url, true, () -> {
                this.rowIndex = -1;
                this.show();
            });
        } else {
            GUIUtil.openWebPage(url);
        }
    });

    VBox vBox = new VBox(featureTitle, imageContainer, featureDescription, learnMore);
    vBox.setAlignment(Pos.CENTER_LEFT);
    vBox.setSpacing(20);
    vBox.setMaxWidth(300);
    return vBox;
}
 
Example 5
Source File: OfferBookView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public void setDirection(OfferPayload.Direction direction) {
    model.initWithDirection(direction);
    ImageView iconView = new ImageView();

    createOfferButton.setGraphic(iconView);
    iconView.setId(direction == OfferPayload.Direction.SELL ? "image-sell-white" : "image-buy-white");
    createOfferButton.setId(direction == OfferPayload.Direction.SELL ? "sell-button-big" : "buy-button-big");
    avatarColumn.setTitle(direction == OfferPayload.Direction.SELL ? Res.get("shared.buyerUpperCase") : Res.get("shared.sellerUpperCase"));
    setDirectionTitles();
}
 
Example 6
Source File: EditOfferView.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
private void updateElementsWithDirection() {
    ImageView iconView = new ImageView();
    iconView.setId(model.isSellOffer() ? "image-sell-white" : "image-buy-white");
    confirmButton.setGraphic(iconView);
    confirmButton.setId(model.isSellOffer() ? "sell-button-big" : "buy-button-big");
}
 
Example 7
Source File: OfferDetailsWindow.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addConfirmAndCancelButtons(boolean isPlaceOffer) {
    boolean isBuyOffer = offer.isBuyOffer();
    boolean isBuyerRole = isPlaceOffer == isBuyOffer;
    String placeOfferButtonText = isBuyerRole ?
            Res.get("offerDetailsWindow.confirm.maker", Res.get("shared.buy")) :
            Res.get("offerDetailsWindow.confirm.maker", Res.get("shared.sell"));
    String takeOfferButtonText = isBuyerRole ?
            Res.get("offerDetailsWindow.confirm.taker", Res.get("shared.buy")) :
            Res.get("offerDetailsWindow.confirm.taker", Res.get("shared.sell"));

    ImageView iconView = new ImageView();
    iconView.setId(isBuyerRole ? "image-buy-white" : "image-sell-white");

    Tuple4<Button, BusyAnimation, Label, HBox> placeOfferTuple = addButtonBusyAnimationLabelAfterGroup(gridPane,
            ++rowIndex, 1,
            isPlaceOffer ? placeOfferButtonText : takeOfferButtonText);

    AutoTooltipButton button = (AutoTooltipButton) placeOfferTuple.first;
    button.setMinHeight(40);
    button.setPadding(new Insets(0, 20, 0, 20));
    button.setGraphic(iconView);
    button.setGraphicTextGap(10);
    button.setId(isBuyerRole ? "buy-button-big" : "sell-button-big");
    button.updateText(isPlaceOffer ? placeOfferButtonText : takeOfferButtonText);

    busyAnimation = placeOfferTuple.second;
    Label spinnerInfoLabel = placeOfferTuple.third;

    Button cancelButton = new AutoTooltipButton(Res.get("shared.cancel"));
    cancelButton.setDefaultButton(false);
    cancelButton.setOnAction(e -> {
        closeHandlerOptional.ifPresent(Runnable::run);
        hide();
    });

    placeOfferTuple.fourth.getChildren().add(cancelButton);

    button.setOnAction(e -> {
        if (GUIUtil.canCreateOrTakeOfferOrShowPopup(user, navigation)) {
            button.setDisable(true);
            cancelButton.setDisable(true);
            busyAnimation.play();
            if (isPlaceOffer) {
                spinnerInfoLabel.setText(Res.get("createOffer.fundsBox.placeOfferSpinnerInfo"));
                placeOfferHandlerOptional.ifPresent(Runnable::run);
            } else {
                spinnerInfoLabel.setText(Res.get("takeOffer.fundsBox.takeOfferSpinnerInfo"));
                takeOfferHandlerOptional.ifPresent(Runnable::run);
            }
        }
    });
}
 
Example 8
Source File: ImageUtil.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
public static ImageView getImageViewById(String id) {
    ImageView imageView = new ImageView();
    imageView.setId(id);
    return imageView;
}