Java Code Examples for javafx.scene.image.ImageView#setOpacity()
The following examples show how to use
javafx.scene.image.ImageView#setOpacity() .
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: RadialSettingsMenu.java From RadialFx with GNU Lesser General Public License v3.0 | 6 votes |
private RadialMenuItem newRadialMenuItem(final ImageView imageView, final ImageView imageViewWhite) { final RadialMenuItem item = RadialMenuItemBuilder.create() .backgroundFill(baseColor).strokeFill(baseColor) .backgroundMouseOnFill(hoverColor) .strokeMouseOnFill(hoverColor).radius(radius) .innerRadius(innerRadius).length(menuSize).clockwise(true) .backgroundVisible(true).strokeVisible(true).offset(0).build(); if (imageViewWhite != null) { item.setGraphic(new Group(imageView, imageViewWhite)); imageViewWhite.setOpacity(0.0); } else { item.setGraphic(new Group(imageView)); } items.add(item); itemAndValueToIcon.put(item, imageView); itemAndValueToWhiteIcon.put(item, imageViewWhite); return item; }
Example 2
Source File: HoverOverlayImageView.java From gef with Eclipse Public License 2.0 | 5 votes |
/** * Creates the {@link ImageView}s for the base and overlay image. Sets the * opacity of the overlay {@link ImageView} to <code>0%</code> and the * opacity of the base {@link ImageView} to <code>80%</code>. */ protected void createImageViews() { baseImageView = new ImageView(); overlayImageView = new ImageView(); getChildren().addAll(baseImageView, overlayImageView); setBlendMode(BlendMode.SRC_OVER); // hide hover image, and show normal image overlayImageView.setOpacity(0); baseImageView.setOpacity(0.8); // 20% transparent }
Example 3
Source File: DaoLaunchWindow.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
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: Splash.java From marathonv5 with Apache License 2.0 | 4 votes |
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 5
Source File: Splash.java From marathonv5 with Apache License 2.0 | 4 votes |
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 6
Source File: Splash.java From netbeans with Apache License 2.0 | 4 votes |
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 7
Source File: About.java From Game2048FX with GNU General Public License v3.0 | 4 votes |
public About() { HBox title = new HBox(10); title.setAlignment(Pos.CENTER_LEFT); title.getChildren().add(new ImageView()); title.getChildren().add(new Label("About the App")); Dialog<ButtonType> dialog = new Dialog<>(); Text t00 = new Text("2048"); t00.getStyleClass().setAll("game-label","game-lblAbout"); Text t01 = new Text("FX"); t01.getStyleClass().setAll("game-label","game-lblAbout2"); Text t02 = new Text(" Game\n"); t02.getStyleClass().setAll("game-label","game-lblAbout"); Text t1 = new Text("JavaFX game - " + Platform.getCurrent().name() + " version\n\n"); t1.getStyleClass().setAll("game-label", "game-lblAboutSub"); Text t20 = new Text("Powered by "); t20.getStyleClass().setAll("game-label", "game-lblAboutSub"); Hyperlink link11 = new Hyperlink(); link11.setText("JavaFXPorts"); link11.setOnAction(e -> browse("http://gluonhq.com/open-source/javafxports/")); link11.getStyleClass().setAll("game-label", "game-lblAboutSub2"); Text t210 = new Text(" & "); t210.getStyleClass().setAll("game-label", "game-lblAboutSub"); Hyperlink link12 = new Hyperlink(); link12.setText("Gluon Mobile"); link12.setOnAction(e -> browse("https://gluonhq.com/products/mobile/")); link12.getStyleClass().setAll("game-label", "game-lblAboutSub2"); Text t21 = new Text(" Projects \n\n"); t21.getStyleClass().setAll("game-label", "game-lblAboutSub"); Text t23 = new Text("\u00A9 "); t23.getStyleClass().setAll("game-label", "game-lblAboutSub"); Hyperlink link2 = new Hyperlink(); link2.setText("José Pereda"); link2.setOnAction(e -> browse("https://twitter.com/JPeredaDnr")); link2.getStyleClass().setAll("game-label", "game-lblAboutSub2"); Text t22 = new Text(", "); t22.getStyleClass().setAll("game-label", "game-lblAboutSub"); Hyperlink link3 = new Hyperlink(); link3.setText("Bruno Borges"); link3.setOnAction(e -> browse("https://twitter.com/brunoborges")); Text t32 = new Text(" & "); t32.getStyleClass().setAll("game-label", "game-lblAboutSub"); link3.getStyleClass().setAll("game-label", "game-lblAboutSub2"); Hyperlink link4 = new Hyperlink(); link4.setText("Jens Deters"); link4.setOnAction(e -> browse("https://twitter.com/Jerady")); link4.getStyleClass().setAll("game-label", "game-lblAboutSub2"); Text t24 = new Text("\n\n"); t24.getStyleClass().setAll("game-label", "game-lblAboutSub"); Text t31 = new Text(" Version " + Game2048.VERSION + " - " + Year.now().toString() + "\n\n"); t31.getStyleClass().setAll("game-label", "game-lblAboutSub"); TextFlow flow = new TextFlow(); flow.setTextAlignment(TextAlignment.CENTER); flow.setPadding(new Insets(10,0,0,0)); flow.getChildren().setAll(t00, t01, t02, t1, t20, link11, t210, link12, t21, t23, link2, t22, link3); flow.getChildren().addAll(t32, link4); flow.getChildren().addAll(t24, t31); final ImageView imageView = new ImageView(); imageView.getStyleClass().add("about"); double scale = Services.get(DisplayService.class) .map(display -> { if (display.isTablet()) { flow.setTranslateY(30); return 1.3; } else { flow.setTranslateY(25); return 1.0; } }) .orElse(1.0); imageView.setFitWidth(270 * scale); imageView.setFitHeight(270 * scale); imageView.setOpacity(0.1); dialog.setContent(new StackPane(imageView, flow)); dialog.setTitle(title); Button yes = new Button("Accept"); yes.setOnAction(e -> { dialog.setResult(ButtonType.YES); dialog.hide(); }); yes.setDefaultButton(true); dialog.getButtons().addAll(yes); javafx.application.Platform.runLater(dialog::showAndWait); }
Example 8
Source File: LcdClockSkin.java From Enzo with Apache License 2.0 | 4 votes |
private void initGraphics() { // load the fonts Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/digital.ttf"), (0.5833333333 * PREFERRED_HEIGHT)); // "Digital-7" Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/digitalreadout.ttf"), (0.5833333333 * PREFERRED_HEIGHT)); // "Digital Readout Upright" Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/digitalreadoutb.ttf"), (0.5833333333 * PREFERRED_HEIGHT)); // "Digital Readout Thick Upright" Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/elektra.ttf"), (0.58333333 * PREFERRED_HEIGHT)); // "Elektra" Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/opensans-semibold.ttf"), (0.58333333 * PREFERRED_HEIGHT)); // "OpenSans" main = new Region(); main.getStyleClass().setAll("main"); main.setOpacity(getSkinnable().isBackgroundVisible() ? 1 : 0); mainInnerShadow0 = new InnerShadow(); mainInnerShadow0.setOffsetX(0.0); mainInnerShadow0.setOffsetY(0.0); mainInnerShadow0.setRadius(3.0 / 132.0 * PREFERRED_WIDTH); mainInnerShadow0.setColor(Color.web("0xffffff80")); 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.web("0x000000a6")); mainInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX); mainInnerShadow1.setInput(mainInnerShadow0); main.setEffect(getSkinnable().isMainInnerShadowVisible() ? mainInnerShadow1 : null); crystalClip = new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT); crystalClip.setArcWidth(5); crystalClip.setArcHeight(5); crystalImage = createNoiseImage(PREFERRED_WIDTH, PREFERRED_HEIGHT, DARK_NOISE_COLOR, BRIGHT_NOISE_COLOR, 8); crystalOverlay = new ImageView(crystalImage); crystalOverlay.setClip(this.crystalClip); crystalOverlay.setOpacity(getSkinnable().isCrystalOverlayVisible() ? 1 : 0); alarm = new Region(); alarm.getStyleClass().setAll("alarm"); alarm.setOpacity(getSkinnable().getAlarms().isEmpty() || allAlarmsInactive() ? 0 : 1); backgroundTimeText = new Text(""); backgroundTimeText.getStyleClass().setAll("fg-trsp"); backgroundTimeText.setOpacity((LcdClock.LcdFont.LCD == getSkinnable().getTimeFont() || LcdClock.LcdFont.ELEKTRA == getSkinnable().getTimeFont()) ? 1 : 0); timeText = new Text(""); timeText.getStyleClass().setAll("fg"); backgroundSecondText = new Text(""); backgroundSecondText.getStyleClass().setAll("fg-trsp"); backgroundSecondText.setOpacity((LcdClock.LcdFont.LCD == getSkinnable().getTimeFont() || LcdClock.LcdFont.ELEKTRA == getSkinnable().getTimeFont()) ? 1 : 0); secondText = new Text(""); secondText.getStyleClass().setAll("fg"); title = new Text(getSkinnable().getTitle()); title.getStyleClass().setAll("fg"); dateText = new Text(getSkinnable().getTime().getMonthValue() + "/" + getSkinnable().getTime().getDayOfMonth() + "/" + getSkinnable().getTime().getYear()); dateText.getStyleClass().setAll("fg"); dayOfWeekText = new Text(""); dayOfWeekText.getStyleClass().setAll("fg"); shadowGroup = new Group(); shadowGroup.setEffect(getSkinnable().isForegroundShadowVisible() ? FOREGROUND_SHADOW : null); shadowGroup.getChildren().setAll(alarm, timeText, secondText, title, dateText, dayOfWeekText); pane = new Pane(); pane.getChildren().setAll(main, crystalOverlay, backgroundTimeText, backgroundSecondText, shadowGroup); getChildren().setAll(pane); resize(); updateLcd(); }