List of usage examples for javafx.scene.image ImageView ImageView
public ImageView(Image image)
From source file:photobooth.views.ExplorerPane.java
private void addUpButton() throws IOException { Button button = new Button(); button.setGraphic(//from ww w . j a v a 2s . c om new ImageView(new Image(getClass().getResource("/photobooth/images/up.png").openStream()))); button.setStyle("-fx-background-color: transparent;"); button.setMaxSize(50, 50); button.setMinSize(50, 50); button.setLayoutX(120); button.setLayoutY(10); this.getChildren().add(button); button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Global.getInstance().setSceneRoot(LoadingPane.getInstance()); Platform.runLater(() -> { new Thread(new Runnable() { @Override public void run() { ExplorerPane.getInstance().setDir(new File(dir).getParentFile().getAbsolutePath(), 0, limit, directoryLevel - 1); Global.getInstance().setSceneRoot(ExplorerPane.getInstance()); } }).start(); }); } }); }
From source file:org.ykc.usbcx.MainWindowController.java
@Override public void initialize(URL arg0, ResourceBundle arg1) { Preferences.genTempFolders(); Preferences.loadPreferences(); bOpen.setGraphic(new ImageView(new Image("/open.png"))); bOpen.setTooltip(new Tooltip("Open ucx1 file")); bSave.setGraphic(new ImageView(new Image("/save.png"))); bSave.setTooltip(new Tooltip("Save ucx1 file")); bStartStop.setGraphic(new ImageView(new Image("/start_stop.png"))); bStartStop.setTooltip(new Tooltip("Start/Stop Capture")); bReset.setGraphic(new ImageView(new Image("/reset.png"))); bReset.setTooltip(new Tooltip("Reset and clear")); bTrigger.setGraphic(new ImageView(new Image("/trigger.png"))); bTrigger.setTooltip(new Tooltip("Set Trigger")); bGetVersion.setGraphic(new ImageView(new Image("/version.png"))); bGetVersion.setTooltip(new Tooltip("Get Version")); bDownload.setGraphic(new ImageView(new Image("/download.png"))); bDownload.setTooltip(new Tooltip("Download FW")); bAbout.setGraphic(new ImageView(new Image("/info.png"))); bAbout.setTooltip(new Tooltip("About USBCx")); bFirstPage.setGraphic(new ImageView(new Image("/double_arrow_left.png"))); bFirstPage.setTooltip(new Tooltip("Go to First Page")); bPrevPage.setGraphic(new ImageView(new Image("/arrow_left.png"))); bPrevPage.setTooltip(new Tooltip("Go to Previous Page")); bNextPage.setGraphic(new ImageView(new Image("/arrow_right.png"))); bNextPage.setTooltip(new Tooltip("Go to Next Page")); bLastPage.setGraphic(new ImageView(new Image("/double_arrow_right.png"))); bLastPage.setTooltip(new Tooltip("Go to Last Page")); bCollapse.setGraphic(new ImageView(new Image("/collapse.png"))); bCollapse.setTooltip(new Tooltip("Collapse Items")); bExpand.setGraphic(new ImageView(new Image("/expand.png"))); bExpand.setTooltip(new Tooltip("Expand Items")); bGraphScrollLeft.setGraphic(new ImageView(new Image("/arrow_left.png"))); bGraphScrollLeft.setTooltip(new Tooltip("Previous plot")); bGraphScrollRight.setGraphic(new ImageView(new Image("/arrow_right.png"))); bGraphScrollRight.setTooltip(new Tooltip("Next plot")); ttColPVName.setCellValueFactory(new TreeItemPropertyValueFactory<DetailsRow, String>("name")); ttColPVValue.setCellValueFactory(new TreeItemPropertyValueFactory<DetailsRow, String>("value")); ttColPVDecimal.setCellValueFactory(new TreeItemPropertyValueFactory<DetailsRow, String>("decval")); ttColPVHex.setCellValueFactory(new TreeItemPropertyValueFactory<DetailsRow, String>("hexval")); ttColPVBinary.setCellValueFactory(new TreeItemPropertyValueFactory<DetailsRow, String>("binaryval")); ttColPVLength.setCellValueFactory(new TreeItemPropertyValueFactory<DetailsRow, String>("len")); ttColPVOffset.setCellValueFactory(new TreeItemPropertyValueFactory<DetailsRow, String>("offset")); TreeItem<DetailsRow> rootItem = new TreeItem<DetailsRow>(); ttViewParseViewer.setRoot(rootItem); ttColPVName.setCellFactory((TreeTableColumn<DetailsRow, String> param) -> { TreeTableCell<DetailsRow, String> cell = new TreeTableCell<DetailsRow, String>() { @Override/*from w w w. j a va2 s. c o m*/ protected void updateItem(String item, boolean empty) { super.updateItem(item, empty); setText(empty ? "" : getItem().toString()); TreeTableRow<DetailsRow> ttr = getTreeTableRow(); DetailsRow x = ttr.getItem(); DetailsRow.BG bg = BG.NORMAL; String style = ""; if (x != null) { bg = x.getBcolor(); style += x.getBold() ? "-fx-font-weight:bold;-fx-font-style:italic;" : ""; } switch (bg) { case RED: style += "-fx-text-fill:red;"; break; case GREEN: style += "-fx-text-fill:green;"; break; case BLUE: style += "-fx-text-fill:blue;"; break; case YELLOW: style += "-fx-text-fill:yellow;"; break; case PINK: style += "-fx-text-fill:pink;"; break; default: style += "-fx-text-fill:white;" + "-fx-highlight-fill:dodgerblue;" + "-fx-highlight-text-fill:white"; break; } setStyle(style); } }; return cell; }); tColMViewSno.setCellValueFactory(new PropertyValueFactory<MainViewRow, String>("sno")); tColMViewOk.setCellValueFactory(new PropertyValueFactory<MainViewRow, String>("ok")); tColMViewSop.setCellValueFactory(new PropertyValueFactory<MainViewRow, String>("sop")); tColMViewMsg.setCellValueFactory(new PropertyValueFactory<MainViewRow, String>("msg")); tColMViewId.setCellValueFactory(new PropertyValueFactory<MainViewRow, String>("id")); tColMViewDrole.setCellValueFactory(new PropertyValueFactory<MainViewRow, String>("drole")); tColMViewProle.setCellValueFactory(new PropertyValueFactory<MainViewRow, String>("prole")); tColMViewCount.setCellValueFactory(new PropertyValueFactory<MainViewRow, String>("count")); tColMViewRev.setCellValueFactory(new PropertyValueFactory<MainViewRow, String>("rev")); tColMViewDuration.setCellValueFactory(new PropertyValueFactory<MainViewRow, String>("duration")); tColMViewDelta.setCellValueFactory(new PropertyValueFactory<MainViewRow, String>("delta")); tColMViewVbus.setCellValueFactory(new PropertyValueFactory<MainViewRow, String>("vbus")); tColMViewData.setCellValueFactory(new PropertyValueFactory<MainViewRow, String>("data")); tColMViewStartTime.setCellValueFactory(new PropertyValueFactory<MainViewRow, String>("stime")); tColMViewEndTime.setCellValueFactory(new PropertyValueFactory<MainViewRow, String>("etime")); tColDataViewIndex.setCellValueFactory(new PropertyValueFactory<DataViewRow, Integer>("index")); tColDataViewValue.setCellValueFactory(new PropertyValueFactory<DataViewRow, String>("value")); cBoxMsgClass.getItems().addAll(PDUtils.MSG_CLASS); cBoxMsgClass.getSelectionModel().select(0); cBoxMsgType.getItems().addAll(PDUtils.CTRL_MSG_TYPE); cBoxMsgType.getSelectionModel().select(1); cBoxSop.getItems().addAll(PDUtils.SOP_TYPE); cBoxSop.getSelectionModel().select(0); bFirstPage.setDisable(true); bLastPage.setDisable(true); bPrevPage.setDisable(true); bNextPage.setDisable(true); lGraph = new XScope(lchartData, xAxis, yAxis, cboxGraphXScale, bGraphScrollLeft, bGraphScrollRight, chkGraphCC1, chkGraphCC2, chkGraphVbus, chkGraphAmp, lblGraphYValue, lblGraphXValue, lblGraphDeltaY, lblGraphDeltaX); usbcontrol = new USBControl(cBoxDeviceList, statusBar, lblVolt, lblCur, lblCC1, lblCC2); cordinator = new Cordinator(usbcontrol, tViewMain, tViewData, ttViewParseViewer, lblStartDelta, lGraph); Platform.runLater(() -> { handleArgs(); }); }
From source file:slideshow.client.ui.ClientUIController.java
/** * Toggle Music on and off//from w w w .j a va2s . c o m * @param event */ @FXML void playSongClicked(ActionEvent event) { System.out.println("slideshow.client.ui.ClientUIController.playSongClicked"); if (this.mMusic.getMediaPlayer() != null) { System.out.println("slideshow.client.Music." + this.mMusic.getMediaPlayer().getStatus()); if (this.mMusic.getMediaPlayer().getStatus().equals(MediaPlayer.Status.PLAYING)) { this.mMusic.pause(); this.playSongButton.setGraphic(new ImageView(new Image("/slideshow/client/ui/icons/play.png"))); } if (this.mMusic.getMediaPlayer().getStatus().equals(MediaPlayer.Status.PAUSED)) { this.mMusic.play(); this.playSongButton.setGraphic(new ImageView(new Image("/slideshow/client/ui/icons/pause.png"))); } } }
From source file:com.bekwam.mavenpomupdater.MainViewController.java
private void initializeButtonGraphics() { Image cutImage = new Image("images/cut32.png"); tbCut.setGraphic(new ImageView(cutImage)); Image copyImage = new Image("images/copy32.png"); tbCopy.setGraphic(new ImageView(copyImage)); Image pasteImage = new Image("images/paste32.png"); tbPaste.setGraphic(new ImageView(pasteImage)); Image scanImage = new Image("images/scan32.png"); tbScan.setGraphic(new ImageView(scanImage)); Image updateImage = new Image("images/update32.png"); tbUpdate.setGraphic(new ImageView(updateImage)); Image clearImage = new Image("images/clear32.png"); tbClear.setGraphic(new ImageView(clearImage)); Image selImage = new Image("images/select16.png"); btnSelectAll.setGraphic(new ImageView(selImage)); Image deselImage = new Image("images/deselect16.png"); btnDeselectAll.setGraphic(new ImageView(deselImage)); Image lockImage = new Image("images/lock16.png"); lockImageView = new ImageView(lockImage); Image unlockImage = new Image("images/unlock16.png"); unlockImageView = new ImageView(unlockImage); btnLockUnlock.setGraphic(unlockImageView); }
From source file:org.sleuthkit.autopsy.imagegallery.datamodel.DrawableTagsManager.java
public Node getGraphic(TagName tagname) { try {//from w w w. j a v a2 s . c o m if (tagname.equals(getFollowUpTagName())) { return new ImageView(getFollowUpImage()); } else if (tagname.equals(getBookmarkTagName())) { return new ImageView(getBookmarkImage()); } } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Failed to get \"Follow Up\" or \"Bookmark\"tag name from db.", ex); } return DrawableAttribute.TAGS.getGraphicForValue(tagname); }
From source file:Main.java
private TilePane addTilePane() { TilePane tile = new TilePane(); tile.setPadding(new Insets(5, 0, 5, 0)); tile.setVgap(4);/*from w w w . j a va 2 s.co m*/ tile.setHgap(4); tile.setPrefColumns(2); tile.setStyle("-fx-background-color: DAE6F3;"); ImageView pages[] = new ImageView[8]; for (int i = 0; i < 8; i++) { pages[i] = new ImageView( new Image(Main.class.getResourceAsStream("graphics/chart_" + (i + 1) + ".png"))); tile.getChildren().add(pages[i]); } return tile; }
From source file:com.esri.geoevent.test.performance.ui.OrchestratorController.java
/** * Helper method to toggle the UI running state */// www. j av a2s. c o m private void toggleRunningState(boolean newRunningState) { isRunning = newRunningState; if (isRunning) { // start the executor try { this.executor = new OrchestratorRunner(fixtures); this.executor.start(); this.executor.setRunningStateListener(this); } catch (RunningException error) { //TODO: error handling error.printStackTrace(); } // toggle the ui startBtn.setText(UIMessages.getMessage("UI_STOP_BTN_LABEL")); startBtn.setTooltip(new Tooltip(UIMessages.getMessage("UI_STOP_BTN_DESC"))); startBtn.setGraphic( new ImageView(new Image(FixtureController.class.getResourceAsStream(STOP_IMAGE_SOURCE)))); } else { // stop execution if (this.executor != null) { if (this.executor.isRunning()) { this.executor.stop(); } else { this.executor = null; } } startBtn.setText(UIMessages.getMessage("UI_START_BTN_LABEL")); startBtn.setTooltip(new Tooltip(UIMessages.getMessage("UI_START_BTN_DESC"))); startBtn.setGraphic( new ImageView(new Image(FixtureController.class.getResourceAsStream(START_IMAGE_SOURCE)))); } }
From source file:org.sleuthkit.autopsy.timeline.ui.detailview.EventNodeBase.java
final void showHoverControls(final boolean showControls) { Effect dropShadow = dropShadowMap.computeIfAbsent(getEventType(), eventType -> new DropShadow(-10, eventType.getColor())); setEffect(showControls ? dropShadow : null); installTooltip();/*from w w w. j av a 2s .c om*/ enableTooltip(showControls); installActionButtons(); TimeLineController controller = getChartLane().getController(); if (controller.getPinnedEvents().contains(tlEvent)) { pinButton.setOnAction(actionEvent -> { new UnPinEventAction(controller, tlEvent).handle(actionEvent); showHoverControls(true); }); pinButton.setGraphic(new ImageView(UNPIN)); } else { pinButton.setOnAction(actionEvent -> { new PinEventAction(controller, tlEvent).handle(actionEvent); showHoverControls(true); }); pinButton.setGraphic(new ImageView(PIN)); } show(controlsHBox, showControls); if (parentNode != null) { parentNode.showHoverControls(false); } }
From source file:tachyon.view.ProjectProperties.java
public ProjectProperties(JavaProject project, Window w) { this.project = project; stage = new Stage(); stage.initOwner(w);// w w w .ja v a 2 s . com stage.initModality(Modality.APPLICATION_MODAL); stage.setWidth(600); stage.setTitle("Project Properties - " + project.getProjectName()); stage.getIcons().add(tachyon.Tachyon.icon); stage.setResizable(false); HBox mai, libs, one, two, thr, fou; ListView<String> compileList, runtimeList; Button compileAdd, compileRemove, preview, selectIm, runtimeAdd, runtimeRemove; TextField iconField; stage.setScene(new Scene(new VBox(5, pane = new TabPane( new Tab("Library Settings", box1 = new VBox(15, libs = new HBox(10, new Label("External Libraries"), libsView = new ListView<>(), new VBox(5, addJar = new Button("Add Jar"), removeJar = new Button("Remove Jar"))))), new Tab("Program Settings", new ScrollPane(box2 = new VBox(15, one = new HBox(10, new Label("Main-Class"), mainClass = new TextField(project.getMainClassName()), select = new Button("Select")), two = new HBox(10, new Label("Compile-Time Arguments"), compileList = new ListView<>(), new VBox(5, compileAdd = new Button("Add Argument"), compileRemove = new Button("Remove Argument")))))), new Tab("Deployment Settings", box3 = new VBox(15, thr = new HBox(10, new Label("Icon File"), iconField = new TextField(project.getFileIconPath()), preview = new Button("Preview Image"), selectIm = new Button("Select Icon")), fou = new HBox(10, new Label("Runtime Arguments"), runtimeList = new ListView<>(), new VBox(5, runtimeAdd = new Button("Add Argument"), runtimeRemove = new Button("Remove Argument")))))), new VBox(15, mai = new HBox(10, cancel = new Button("Cancel"), confirm = new Button("Confirm")))))); if (applyCss.get()) { stage.getScene().getStylesheets().add(css); } for (Tab b : pane.getTabs()) { b.setClosable(false); } mainClass.setPromptText("Main-Class"); box1.setPadding(new Insets(5, 10, 5, 10)); mai.setAlignment(Pos.CENTER_RIGHT); mai.setPadding(box1.getPadding()); libs.setAlignment(Pos.CENTER); one.setAlignment(Pos.CENTER); two.setAlignment(Pos.CENTER); thr.setAlignment(Pos.CENTER); fou.setAlignment(Pos.CENTER); box1.setAlignment(Pos.CENTER); box2.setPadding(box1.getPadding()); box2.setAlignment(Pos.CENTER); box3.setPadding(box1.getPadding()); box3.setAlignment(Pos.CENTER); mainClass.setEditable(false); mainClass.setPrefWidth(200); for (JavaLibrary lib : project.getAllLibs()) { libsView.getItems().add(lib.getBinaryAbsolutePath()); } for (String sa : project.getCompileTimeArguments().keySet()) { compileList.getItems().add(sa + ":" + project.getCompileTimeArguments().get(sa)); } for (String sa : project.getRuntimeArguments()) { runtimeList.getItems().add(sa); } compileAdd.setOnAction((e) -> { Dialog<Pair<String, String>> dialog = new Dialog<>(); dialog.setTitle("Compiler Argument"); dialog.initOwner(stage); dialog.setHeaderText("Entry the argument"); ButtonType loginButtonType = new ButtonType("Done", ButtonData.OK_DONE); dialog.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL); GridPane grid = new GridPane(); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(20, 150, 10, 10)); TextField username = new TextField(); username.setPromptText("Key"); TextField password = new TextField(); password.setPromptText("Value"); grid.add(new Label("Key:"), 0, 0); grid.add(username, 1, 0); grid.add(new Label("Value:"), 0, 1); grid.add(password, 1, 1); Node loginButton = dialog.getDialogPane().lookupButton(loginButtonType); loginButton.setDisable(true); username.textProperty().addListener((observable, oldValue, newValue) -> { loginButton.setDisable(newValue.trim().isEmpty()); }); dialog.getDialogPane().setContent(grid); Platform.runLater(() -> username.requestFocus()); dialog.setResultConverter(dialogButton -> { if (dialogButton == loginButtonType) { return new Pair<>(username.getText(), password.getText()); } return null; }); Optional<Pair<String, String>> result = dialog.showAndWait(); if (result.isPresent()) { compileList.getItems().add(result.get().getKey() + ":" + result.get().getValue()); } }); compileRemove.setOnAction((e) -> { if (compileList.getSelectionModel().getSelectedItem() != null) { compileList.getItems().remove(compileList.getSelectionModel().getSelectedItem()); } }); runtimeAdd.setOnAction((e) -> { TextInputDialog dia = new TextInputDialog(); dia.setTitle("Add Runtime Argument"); dia.setHeaderText("Enter an argument"); dia.initOwner(stage); Optional<String> res = dia.showAndWait(); if (res.isPresent()) { runtimeList.getItems().add(res.get()); } }); runtimeRemove.setOnAction((e) -> { if (runtimeList.getSelectionModel().getSelectedItem() != null) { runtimeList.getItems().remove(runtimeList.getSelectionModel().getSelectedItem()); } }); preview.setOnAction((e) -> { if (!iconField.getText().isEmpty()) { if (iconField.getText().endsWith(".ico")) { List<BufferedImage> read = new ArrayList<>(); try { read.addAll(ICODecoder.read(new File(iconField.getText()))); } catch (IOException ex) { } if (read.size() >= 1) { Image im = SwingFXUtils.toFXImage(read.get(0), null); Stage st = new Stage(); st.initOwner(stage); st.initModality(Modality.APPLICATION_MODAL); st.setTitle("Icon Preview"); st.getIcons().add(Tachyon.icon); st.setScene(new Scene(new BorderPane(new ImageView(im)))); if (applyCss.get()) { st.getScene().getStylesheets().add(css); } st.showAndWait(); } } else if (iconField.getText().endsWith(".icns")) { try { BufferedImage ima = Imaging.getBufferedImage(new File(iconField.getText())); if (ima != null) { Image im = SwingFXUtils.toFXImage(ima, null); Stage st = new Stage(); st.initOwner(stage); st.initModality(Modality.APPLICATION_MODAL); st.setTitle("Icon Preview"); st.getIcons().add(Tachyon.icon); st.setScene(new Scene(new BorderPane(new ImageView(im)))); if (applyCss.get()) { st.getScene().getStylesheets().add(css); } st.showAndWait(); } } catch (ImageReadException | IOException ex) { } } else { Image im = new Image(new File(iconField.getText()).toURI().toString()); Stage st = new Stage(); st.initOwner(stage); st.initModality(Modality.APPLICATION_MODAL); st.setTitle("Icon Preview"); st.getIcons().add(Tachyon.icon); st.setScene(new Scene(new BorderPane(new ImageView(im)))); if (applyCss.get()) { st.getScene().getStylesheets().add(css); } st.showAndWait(); } } }); selectIm.setOnAction((e) -> { FileChooser fc = new FileChooser(); fc.setTitle("Icon File"); String OS = System.getProperty("os.name").toLowerCase(); fc.getExtensionFilters().add(new ExtensionFilter("Icon File", OS.contains("win") ? getWindowsImageExtensions() : getMacImageExtensions())); fc.setSelectedExtensionFilter(fc.getExtensionFilters().get(0)); File lf = fc.showOpenDialog(stage); if (lf != null) { iconField.setText(lf.getAbsolutePath()); } }); addJar.setOnAction((e) -> { FileChooser f = new FileChooser(); f.setTitle("External Libraries"); f.setSelectedExtensionFilter(new ExtensionFilter("Jar Files", "*.jar")); List<File> showOpenMultipleDialog = f.showOpenMultipleDialog(stage); if (showOpenMultipleDialog != null) { for (File fi : showOpenMultipleDialog) { if (!libsView.getItems().contains(fi.getAbsolutePath())) { libsView.getItems().add(fi.getAbsolutePath()); } } } }); removeJar.setOnAction((e) -> { String selected = libsView.getSelectionModel().getSelectedItem(); if (selected != null) { libsView.getItems().remove(selected); } }); select.setOnAction((e) -> { List<String> all = getAll(); ChoiceDialog<String> di = new ChoiceDialog<>(project.getMainClassName(), all); di.setTitle("Select Main Class"); di.initOwner(stage); di.setHeaderText("Select A Main Class"); Optional<String> show = di.showAndWait(); if (show.isPresent()) { mainClass.setText(show.get()); } }); cancel.setOnAction((e) -> { stage.close(); }); confirm.setOnAction((e) -> { project.setMainClassName(mainClass.getText()); project.setFileIconPath(iconField.getText()); project.setRuntimeArguments(runtimeList.getItems()); HashMap<String, String> al = new HashMap<>(); for (String s : compileList.getItems()) { String[] spl = s.split(":"); al.put(spl[0], spl[1]); } project.setCompileTimeArguments(al); project.setAllLibs(libsView.getItems()); stage.close(); }); }
From source file:photobooth.views.ExplorerPane.java
private void addNextButton() throws IOException { Button button = new Button(); button.setGraphic(//from ww w . ja va 2 s .c o m new ImageView(new Image(getClass().getResource("/photobooth/images/next.png").openStream()))); button.setStyle("-fx-background-radius: 50%; "); button.setStyle("-fx-background-color: transparent;"); button.setLayoutX(740); button.setLayoutY(220); button.setMaxSize(50, 50); button.setMinSize(50, 50); this.getChildren().add(button); button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Global.getInstance().setSceneRoot(LoadingPane.getInstance()); Platform.runLater(() -> { new Thread(new Runnable() { @Override public void run() { ExplorerPane.getInstance().setDir(dir, offset + limit, limit, directoryLevel); Global.getInstance().setSceneRoot(ExplorerPane.getInstance()); } }).start(); }); } }); }