javafx.scene.image.ImageView Java Examples
The following examples show how to use
javafx.scene.image.ImageView.
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: CardPileView.java From Solitaire with GNU General Public License v2.0 | 6 votes |
private EventHandler<DragEvent> createDragEnteredHandler(final ImageView pImageView, final Card pCard) { return new EventHandler<DragEvent>() { @Override public void handle(DragEvent pEvent) { CardTransfer transfer = new CardTransfer(pEvent.getDragboard().getString()); if( GameModel.instance().isLegalMove(transfer.getTop(), aIndex) ) { pImageView.setEffect(new DropShadow()); } pEvent.consume(); } }; }
Example #2
Source File: SceneFileEditor.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
@Override @FxThread protected void createToolbar(@NotNull final HBox container) { super.createToolbar(container); lightButton = new ToggleButton(); lightButton.setTooltip(new Tooltip(Messages.SCENE_FILE_EDITOR_ACTION_SHOW_LIGHTS)); lightButton.setGraphic(new ImageView(Icons.LIGHT_16)); lightButton.setSelected(true); lightButton.selectedProperty().addListener((observable, oldValue, newValue) -> changeLight(newValue)); audioButton = new ToggleButton(); audioButton.setTooltip(new Tooltip(Messages.SCENE_FILE_EDITOR_ACTION_SHOW_AUDIO)); audioButton.setGraphic(new ImageView(Icons.AUDIO_16)); audioButton.setSelected(true); audioButton.selectedProperty().addListener((observable, oldValue, newValue) -> changeAudio(newValue)); DynamicIconSupport.addSupport(lightButton, audioButton); FXUtils.addClassesTo(lightButton, audioButton, CssClasses.FILE_EDITOR_TOOLBAR_BUTTON); FXUtils.addToPane(lightButton, container); FXUtils.addToPane(audioButton, container); }
Example #3
Source File: Icons.java From JRemapper with MIT License | 6 votes |
/** * Get image representation of a class by its access flags. Shows additional * flags such as {@code public, private, etc.}. * * @param access * Flags <i>(Modifiers)</i> * @return Image for flags. */ public static Group getClassExtended(int access) { Group g = getClass(access); if (Access.isPublic(access)) { g.getChildren().add(new ImageView(F_PUBLIC)); } if (Access.isProtected(access)) { g.getChildren().add(new ImageView(F_PROTECTED)); } if (Access.isPrivate(access)) { g.getChildren().add(new ImageView(F_PRIVATE)); } if (Access.isSynthetic(access)) { g.getChildren().add(new ImageView(MOD_SYNTHETIC)); } return g; }
Example #4
Source File: MediaService.java From gluon-samples with BSD 3-Clause "New" or "Revised" License | 6 votes |
public MediaService() { MobileApplication.getInstance().addLayerFactory(POPUP_NAME, () -> { imageView = new ImageView(); imageView.setFitHeight(50); imageView.setPreserveRatio(true); HBox adsBox = new HBox(imageView); adsBox.getStyleClass().add("mediaBox"); return new SidePopupView(adsBox, Side.BOTTOM, false); }); Services.get(LifecycleService.class).ifPresent(service -> { service.addListener(LifecycleEvent.PAUSE, this::stopExecutor); service.addListener(LifecycleEvent.RESUME, this::startExecutor); }); startExecutor(); }
Example #5
Source File: ClientController.java From ChatFX with MIT License | 6 votes |
private void addMsg(String msg, boolean senderIsServer) { Label lbl = new Label(msg); lbl.setStyle("-fx-font-size: 16px;" + "-fx-background-color: #" + (senderIsServer ? "B00020" : "2196f3") + ";" + "-fx-text-fill: #FFF;" + "-fx-background-radius:25;" + "-fx-padding: 10px;"); lbl.setWrapText(true); lbl.setMaxWidth(400); HBox container = new HBox(); if(senderIsServer) { container.getChildren().add(new ImageView(new Image("/images/server-48px.png"))); container.setAlignment(Pos.CENTER_LEFT); container.setSpacing(10); container.setPadding(new Insets(0, 10, 0, 0)); } else { container.setAlignment(Pos.CENTER_RIGHT); container.setPadding(new Insets(0, 10, 0, 10)); } container.getChildren().add(lbl); container.setPrefHeight(40); msgNodes.getItems().add(container); }
Example #6
Source File: UserDetail.java From DashboardFx with GNU General Public License v3.0 | 6 votes |
@Override public Node icon() { Image image = new Image(getClass().getResource("/com/gn/media/img/avatar.png").toExternalForm()); ImageView imageView = new ImageView(image); imageView.setFitHeight(30); imageView.setFitWidth(30); Circle circle = new Circle(12); circle.setStroke(Color.WHITE); circle.setStrokeWidth(5); circle.setCenterX(imageView.getFitWidth() / 2); circle.setCenterY(imageView.getFitHeight() / 2); imageView.setClip(circle); return imageView; }
Example #7
Source File: CoursesTreeView.java From iliasDownloaderTool with GNU General Public License v2.0 | 6 votes |
private void redraw() { if (node == null) { setGraphic(null); return; } final BorderPane pane = new BorderPane(); final Label box = new Label(); box.setAlignment(Pos.TOP_LEFT); if (node instanceof IliasFolder) { IliasFolder folder = (IliasFolder) node; box.setGraphic(folder.getGraphic()); } else if (node instanceof IliasFile) { IliasFile file = (IliasFile) node; box.setGraphic(file.getGraphic()); } else if (node instanceof IliasForum) { box.setGraphic(new ImageView("img/forum.png")); } box.setText(node.toString()); pane.setLeft(box); createAndAddActions(pane); setGraphic(pane); createToolTip(); }
Example #8
Source File: FlowPaneSample.java From marathonv5 with Apache License 2.0 | 6 votes |
public FlowPaneSample() { super(400, 400); FlowPane flowPane = new FlowPane(2, 4); flowPane.setPrefWrapLength(200); //preferred wraplength Label[] shortLabels = new Label[ITEMS]; Label[] longLabels = new Label[ITEMS]; ImageView[] imageViews = new ImageView[ITEMS]; for (int i = 0; i < ITEMS; i++) { shortLabels[i] = new Label("Short label."); longLabels[i] = new Label("I am a slightly longer label."); imageViews[i] = new ImageView(ICON_48); flowPane.getChildren().addAll(shortLabels[i], longLabels[i], imageViews[i]); } getChildren().add(flowPane); }
Example #9
Source File: CheckableImageListCell.java From ShootOFF with GNU General Public License v3.0 | 6 votes |
public static void cacheCamera(Camera c, CameraSelectionListener listener) { final ImageView iv = new ImageView(); iv.setFitWidth(100); iv.setFitHeight(75); new Thread(() -> { final Optional<Image> img = fetchWebcamImage(c); if (img.isPresent()) { iv.setImage(img.get()); } }, "FetchImageCellWebcamImages").start(); final CheckBox cb = new CheckBox(); cb.setOnAction((event) -> { if (listener != null) listener.cameraSelectionChanged(c, cb.isSelected()); }); checkCache.put(c, cb); final HBox webcamContainer = new HBox(cb, iv); webcamContainer.setAlignment(Pos.CENTER); containerCache.put(c, webcamContainer); }
Example #10
Source File: StatisticCellWithArrows.java From trex-stateless-gui with Apache License 2.0 | 6 votes |
public StatisticCellWithArrows(double width, boolean odd, String unit) { this.unit = unit; setPrefSize(width, 22); setSpacing(5); setAlignment(Pos.CENTER_RIGHT); Platform.runLater(() -> { getStyleClass().add("statsTableColCell"); if (odd) { getStyleClass().add("statsTableColCellOdd"); } }); imageView = new ImageView(); getChildren().add(imageView); value = new Label(); getChildren().add(value); }
Example #11
Source File: JavaDocTab.java From scenic-view with GNU General Public License v3.0 | 6 votes |
public JavaDocTab(final ScenicViewGui view) { super(TAB_NAME); this.scenicView = view; this.webView = new ProgressWebView(); webView.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); setContent(webView); setGraphic(new ImageView(DisplayUtils.getUIImage("javadoc.png"))); setClosable(false); selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(final ObservableValue<? extends Boolean> arg0, final Boolean arg1, final Boolean newValue) { if (newValue) { DisplayUtils.showWebView(true); loadAPI(null); } else { DisplayUtils.showWebView(false); } } }); }
Example #12
Source File: ImageMosaicStep.java From TweetwallFX with MIT License | 5 votes |
private Transition createMosaicTransition(final List<ImageStore> imageStores) { final SequentialTransition fadeIn = new SequentialTransition(); final List<FadeTransition> allFadeIns = new ArrayList<>(); final double width = pane.getWidth() / 6.0 - 10; final double height = pane.getHeight() / 5.0 - 8; final List<ImageStore> distillingList = new ArrayList<>(imageStores); for (int i = 0; i < 6; i++) { for (int j = 0; j < 5; j++) { int index = RANDOM.nextInt(distillingList.size()); ImageStore selectedImage = distillingList.remove(index); ImageView imageView = new ImageView(selectedImage.getImage()); imageView.setCache(true); imageView.setCacheHint(CacheHint.SPEED); imageView.setFitWidth(width); imageView.setFitHeight(height); imageView.setEffect(new GaussianBlur(0)); rects[i][j] = imageView; bounds[i][j] = new BoundingBox(i * (width + 10) + 5, j * (height + 8) + 4, width, height); rects[i][j].setOpacity(0); rects[i][j].setLayoutX(bounds[i][j].getMinX()); rects[i][j].setLayoutY(bounds[i][j].getMinY()); pane.getChildren().add(rects[i][j]); FadeTransition ft = new FadeTransition(Duration.seconds(0.3), imageView); ft.setToValue(1); allFadeIns.add(ft); } } Collections.shuffle(allFadeIns); fadeIn.getChildren().addAll(allFadeIns); return fadeIn; }
Example #13
Source File: PlotConfigDialog.java From phoebus with Eclipse Public License 1.0 | 5 votes |
public PlotConfigDialog(final RTPlot<XTYPE> plot) { this.plot = plot; initModality(Modality.NONE); setTitle(Messages.PlotConfigDlgTitle); setHeaderText(Messages.PlotConfigHdr); try { setGraphic(new ImageView(Activator.getIcon("configure"))); } catch (Exception ex) { // Ignore } getDialogPane().setContent(createContent()); getDialogPane().getButtonTypes().addAll(ButtonType.CLOSE); setResizable(true); setResultConverter(button -> { // Release plot since dialog is held in memory for a while this.plot = null; return null; }); }
Example #14
Source File: ItemItemController.java From logbook-kai with MIT License | 5 votes |
@Override protected void updateItem(Integer alv, boolean empty) { super.updateItem(alv, empty); if (!empty && alv != null && alv > 0) { URL url = PluginServices.getResource("logbook/gui/alv" + alv + ".png"); Pane pane = new StackPane(new ImageView(url.toString())); pane.setPrefWidth(16); pane.setPrefHeight(16); this.setGraphic(pane); } else { this.setGraphic(null); this.setText(null); } }
Example #15
Source File: FXUIUtils.java From marathonv5 with Apache License 2.0 | 5 votes |
public Node create() { if (font == null) { return new ImageView(); } Label label = new Label(); label.getStyleClass().add("image-label-" + fontSuffix); label.setFont(font); if (color != null) label.setTextFill(color); label.setText(namedChar.getChar() + ""); return label; }
Example #16
Source File: Bat.java From marathonv5 with Apache License 2.0 | 5 votes |
public Bat() { height = (int)CENTER.getHeight() - Config.SHADOW_HEIGHT; Group group = new Group(); leftImageView = new ImageView(); leftImageView.setImage(LEFT); centerImageView = new ImageView(); centerImageView.setImage(CENTER); centerImageView.setTranslateX(LEFT.getWidth()); rightImageView = new ImageView(); rightImageView.setImage(RIGHT); changeSize(DEFAULT_SIZE); group.getChildren().addAll(leftImageView, centerImageView, rightImageView); getChildren().add(group); setMouseTransparent(true); }
Example #17
Source File: FullScreenAction.java From phoebus with Eclipse Public License 1.0 | 5 votes |
public FullScreenAction(final Stage stage) { stage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH); // XXX Automatically combine 'full screen' with DockPane.alwaysShowTabs(false) ? final boolean full = stage.isFullScreen(); setText(full ? Messages.ExitFullScreen : Messages.EnterFullScreen); setGraphic(new ImageView(full ? exit : enter)); setOnAction(event -> stage.setFullScreen(! full)); }
Example #18
Source File: OptionsDisplaySetupPanel.java From Quelea with GNU General Public License v3.0 | 5 votes |
Category getDisplaySetupTab() { return Category.of(LabelGrabber.INSTANCE.getLabel("display.options.heading"), new ImageView(new Image("file:icons/monitorsettingsicon.png")), //, new ImageView(new Image("file:icons/monitorsettingsicon.png")), controlScreen.getGroup(), projectorScreen.getGroup(), stageScreen.getGroup() ); }
Example #19
Source File: PictureRepresentation.java From phoebus with Eclipse Public License 1.0 | 5 votes |
@Override public ImageView createJFXNode() throws Exception { final ImageView iv = new ImageView(); iv.setSmooth(true); iv.getTransforms().addAll(translate, rotation); return iv; }
Example #20
Source File: AbstractNodeAction.java From jmonkeybuilder with Apache License 2.0 | 5 votes |
AbstractNodeAction(@NotNull final NodeTree<?> nodeTree, @NotNull final TreeNode<?> node, @NotNull final Array<TreeNode<?>> nodes) { this.nodeTree = unsafeCast(nodeTree); this.node = node; this.nodes = nodes; setOnAction(event -> process()); setText(getName()); final Image icon = getIcon(); if (icon != null) { setGraphic(new ImageView(icon)); } }
Example #21
Source File: EventLogTab.java From scenic-view with GNU General Public License v3.0 | 5 votes |
public EventLogTab(final ScenicViewGui view) { super(TAB_NAME); this.scenicView = view; setContent(buildUI()); setGraphic(new ImageView(DisplayUtils.getUIImage("flag_red.png"))); setClosable(false); }
Example #22
Source File: EditingMultiBaseStyleLongCell.java From CPUSim with GNU General Public License v3.0 | 5 votes |
/** * updates the Long in the table cell * @param item used for the parent method * @param empty used for the parent method */ @Override public void updateItem(Long item, boolean empty) { super.updateItem(item, empty); if( styleInfo != null ) styleInfo.setFontAndBackground(this); if (empty || item == null) { setText(null); setGraphic(null); setTooltip(null); } else if (isEditing()) { if (textField != null) { textField.setText(formatString(prepareString(getString()))); } setText(null); setGraphic(textField); } else { setTooltipsAndCellSize(); setText(formatString(convertLong(Long.parseLong(getString())))); if(isReadOnlyRegisterValue()) { ImageView graphic = new ImageView(new Image("/images/icons/Lock.png")); graphic.setFitHeight(styleInfo == null ? this.getHeight() : Integer.parseInt(styleInfo.fontSize)); graphic.setSmooth(true); graphic.setPreserveRatio(true); graphic.setCache(true); setContentDisplay(ContentDisplay.RIGHT); setGraphic(graphic); } else setGraphic(null); } }
Example #23
Source File: OfferBookView.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
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 #24
Source File: SynchronizationUtils.java From PeerWasp with MIT License | 5 votes |
/** * Loads the given resource and returns a new ImageView instance. * @param resourceName specifying image * @return image view with associated resource. */ private static ImageView getImageByName(String resourceName) { try (InputStream in = SynchronizationUtils.class.getResourceAsStream(resourceName)) { if (in != null) { return new ImageView(new Image(in)); } } catch (IOException e) { Logger logger = LoggerFactory.getLogger(SynchronizationUtils.class); logger.warn("Could not load icon '{}'.", resourceName, e); } return new ImageView(); }
Example #25
Source File: Refund.java From HealthPlus with Apache License 2.0 | 5 votes |
public Refund(String patientID,String date, String billID, String service, String bill, ImageView refund) { setPatientID(patientID); setDate(date); setBillID(billID); setService(service); setBill(bill); setRefund(refund); }
Example #26
Source File: AboutDialog.java From milkman with MIT License | 5 votes |
public AboutDialogDialogFxml(AboutDialog controller){ setHeading(label("About Milkman")); var vbox = new VboxExt(); vbox.setAlignment(Pos.CENTER); vbox.add(new ImageView(new Image(getClass().getResourceAsStream("/images/icon.png"), 100, 100, true, true))); vbox.add(label("Version " + VersionLoader.loadCurrentVersion())); var hyperlink = controller.link = new Hyperlink("http://github.com/warmuuh/milkman"); vbox.add(hyperlink); setBody(vbox); setActions(cancel(controller::onClose, "Close")); }
Example #27
Source File: Controller.java From PoE_Level_Buddy with MIT License | 5 votes |
private void hideSelectors() { for (RadioButton r : radioButtons) { r.setVisible(false); r.setSelected(false); } for (ImageView i : gemIcons) i.setVisible(false); }
Example #28
Source File: VgaController.java From Sword_emulator with GNU General Public License v3.0 | 5 votes |
public VgaController(ImageView screen, Machine machine) { content = new WritableImage(WIDTH, HEIGHT); this.machine = machine; placeHolder = new Image(VgaController.class.getResourceAsStream("/drawable/placeholder.jpg")); this.screen = screen; screen.setImage(placeHolder); graphProvider = new GraphProvider(machine); textProvider = new TextProvider(machine); TimingRenderer.register(this); }
Example #29
Source File: ImagesBrowserController.java From MyBox with Apache License 2.0 | 5 votes |
public void zoomOut(int index) { ImageView iView = imageViewList.get(index); ScrollPane sPane = imageScrollList.get(index); if (iView == null || iView.getImage() == null) { return; } FxmlControl.zoomOut(sPane, iView, xZoomStep, yZoomStep); }
Example #30
Source File: ListImageCheckBoxCell.java From MyBox with Apache License 2.0 | 5 votes |
private void init() { view = new ImageView(); view.setPreserveRatio(true); view.setFitHeight(imageSize); rect = new Rectangle(); rect.setWidth(40); rect.setHeight(40); Callback<ImageItem, ObservableValue<Boolean>> itemToBoolean = (ImageItem item) -> item.getSelected(); setSelectedStateCallback(itemToBoolean); }