List of usage examples for javafx.scene.image ImageView ImageView
public ImageView(Image image)
From source file:Jigs_Desktop_Client.GUI.FXMLDocumentController.java
@Override public void initialize(URL url, ResourceBundle rb) { this.alert("resources/app_launch.mp3"); this.user_name.requestFocus(); this.btn_logout.setDisable(true); this.jc.setStatus(from_user, "online"); this.my_circle_list.setCellFactory(new Callback<ListView<UserStatus>, ListCell<UserStatus>>() { @Override/* www .j av a 2 s .c o m*/ public ListCell<UserStatus> call(ListView<UserStatus> userObj) { ListCell<UserStatus> cell = new ListCell<UserStatus>() { @Override protected void updateItem(UserStatus usrObj, boolean btnl) { super.updateItem(usrObj, btnl); if (usrObj != null) { String filename = usrObj.getStatus(); if (filename == null || filename.equals("") || filename.equals("null")) filename = "offline"; else System.out.println(filename); Image img = new Image( getClass().getResource("resources/" + filename + ".png").toExternalForm()); ImageView imv = new ImageView(img); setGraphic(imv); setText(usrObj.getUsername()); } } }; return cell; } }); this.main_panel.setBackground(Background.EMPTY); this.text_message.setOnKeyPressed(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent keyEvent) { if (keyEvent.getCode() == KeyCode.ENTER) { sendMessage(null); keyEvent.consume(); } } }); }
From source file:jduagui.Controller.java
private TreeItem<File> buildFileTree(String path) throws IOException { File f = new File(path); TreeItem<File> root = createNode(f); root.setExpanded(true);//from w w w . ja v a 2s . com root.setGraphic(new ImageView(new Image(getClass().getResourceAsStream("/16x16/apps/gnome-disks.png")))); return root; }
From source file:com.esri.geoevent.test.performance.ui.FixtureController.java
private void setEditNameState(boolean newState) { if (newState != isEditingName) { isEditingName = newState;// ww w. ja v a 2s. c o m if (isEditingName) { editNameBtn.setTooltip(new Tooltip(UIMessages.getMessage("UI_FIXTURE_SAVE_NAME_DESC"))); editNameBtn.setGraphic( new ImageView(new Image(FixtureController.class.getResourceAsStream(SAVE_IMAGE_SOURCE)))); nameField.setEditable(true); } else { editNameBtn.setTooltip(new Tooltip(UIMessages.getMessage("UI_FIXTURE_EDIT_NAME_DESC"))); editNameBtn.setGraphic( new ImageView(new Image(FixtureController.class.getResourceAsStream(EDIT_IMAGE_SOURCE)))); nameField.setEditable(false); } } }
From source file:org.sleuthkit.autopsy.imagegallery.gui.GroupPane.java
/** * called automatically during constructor by FXMLConstructor. * * checks that FXML loading went ok and performs additional setup *///from w ww .j av a 2s . com @FXML void initialize() { assert gridView != null : "fx:id=\"tilePane\" was not injected: check your FXML file 'GroupPane.fxml'."; assert grpCatSplitMenu != null : "fx:id=\"grpCatSplitMenu\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert grpTagSplitMenu != null : "fx:id=\"grpTagSplitMenu\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert headerToolBar != null : "fx:id=\"headerToolBar\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert segButton != null : "fx:id=\"previewList\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert slideShowToggle != null : "fx:id=\"segButton\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert tileToggle != null : "fx:id=\"tileToggle\" was not injected: check your FXML file 'GroupHeader.fxml'."; //configure flashing glow animation on next unseen group button flashAnimation.setCycleCount(Timeline.INDEFINITE); flashAnimation.setAutoReverse(true); //configure gridView cell properties gridView.cellHeightProperty().bind(Toolbar.getDefault().sizeSliderValue().add(75)); gridView.cellWidthProperty().bind(Toolbar.getDefault().sizeSliderValue().add(75)); gridView.setCellFactory((GridView<Long> param) -> new DrawableCell()); //configure toolbar properties HBox.setHgrow(spacer, Priority.ALWAYS); spacer.setMinWidth(Region.USE_PREF_SIZE); try { grpTagSplitMenu.setText(TagUtils.getFollowUpTagName().getDisplayName()); grpTagSplitMenu.setOnAction(createGrpTagMenuItem(TagUtils.getFollowUpTagName()).getOnAction()); } catch (TskCoreException tskCoreException) { LOGGER.log(Level.WARNING, "failed to load FollowUpTagName", tskCoreException); } grpTagSplitMenu.setGraphic(new ImageView(DrawableAttribute.TAGS.getIcon())); grpTagSplitMenu.showingProperty() .addListener((ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) -> { if (t1) { ArrayList<MenuItem> selTagMenues = new ArrayList<>(); for (final TagName tn : TagUtils.getNonCategoryTagNames()) { MenuItem menuItem = TagUtils.createSelTagMenuItem(tn, grpTagSplitMenu); selTagMenues.add(menuItem); } grpTagSplitMenu.getItems().setAll(selTagMenues); } }); ArrayList<MenuItem> grpCategoryMenues = new ArrayList<>(); for (final Category cat : Category.values()) { MenuItem menuItem = createGrpCatMenuItem(cat); grpCategoryMenues.add(menuItem); } grpCatSplitMenu.setText(Category.FIVE.getDisplayName()); grpCatSplitMenu.setGraphic(new ImageView(DrawableAttribute.CATEGORY.getIcon())); grpCatSplitMenu.getItems().setAll(grpCategoryMenues); grpCatSplitMenu.setOnAction(createGrpCatMenuItem(Category.FIVE).getOnAction()); Runnable syncMode = () -> { switch (groupViewMode.get()) { case SLIDE_SHOW: slideShowToggle.setSelected(true); break; case TILE: tileToggle.setSelected(true); break; } }; syncMode.run(); //make togle states match view state groupViewMode.addListener((o) -> { syncMode.run(); }); slideShowToggle.toggleGroupProperty().addListener((o) -> { slideShowToggle.getToggleGroup().selectedToggleProperty() .addListener((observable, oldToggle, newToggle) -> { if (newToggle == null) { oldToggle.setSelected(true); } }); }); //listen to toggles and update view state slideShowToggle.setOnAction((ActionEvent t) -> { activateSlideShowViewer(globalSelectionModel.lastSelectedProperty().get()); }); tileToggle.setOnAction((ActionEvent t) -> { activateTileViewer(); }); controller.viewState().addListener((ObservableValue<? extends GroupViewState> observable, GroupViewState oldValue, GroupViewState newValue) -> { setViewState(newValue); }); addEventFilter(KeyEvent.KEY_PRESSED, tileKeyboardNavigationHandler); gridView.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() { private ContextMenu buildContextMenu() { ArrayList<MenuItem> menuItems = new ArrayList<>(); menuItems.add(CategorizeAction.getPopupMenu()); menuItems.add(AddDrawableTagAction.getInstance().getPopupMenu()); Collection<? extends ContextMenuActionsProvider> menuProviders = Lookup.getDefault() .lookupAll(ContextMenuActionsProvider.class); for (ContextMenuActionsProvider provider : menuProviders) { for (final Action act : provider.getActions()) { if (act instanceof Presenter.Popup) { Presenter.Popup aact = (Presenter.Popup) act; menuItems.add(SwingMenuItemAdapter.create(aact.getPopupPresenter())); } } } final MenuItem extractMenuItem = new MenuItem("Extract File(s)"); extractMenuItem.setOnAction((ActionEvent t) -> { SwingUtilities.invokeLater(() -> { TopComponent etc = WindowManager.getDefault() .findTopComponent(ImageGalleryTopComponent.PREFERRED_ID); ExtractAction.getInstance().actionPerformed(new java.awt.event.ActionEvent(etc, 0, null)); }); }); menuItems.add(extractMenuItem); ContextMenu contextMenu = new ContextMenu(menuItems.toArray(new MenuItem[] {})); contextMenu.setAutoHide(true); return contextMenu; } @Override public void handle(MouseEvent t) { switch (t.getButton()) { case PRIMARY: if (t.getClickCount() == 1) { globalSelectionModel.clearSelection(); if (contextMenu != null) { contextMenu.hide(); } } t.consume(); break; case SECONDARY: if (t.getClickCount() == 1) { selectAllFiles(); } if (globalSelectionModel.getSelected().isEmpty() == false) { if (contextMenu == null) { contextMenu = buildContextMenu(); } contextMenu.hide(); contextMenu.show(GroupPane.this, t.getScreenX(), t.getScreenY()); } t.consume(); break; } } }); ActionUtils.configureButton(nextGroupAction, nextButton); final EventHandler<ActionEvent> onAction = nextButton.getOnAction(); nextButton.setOnAction((ActionEvent event) -> { flashAnimation.stop(); nextButton.setEffect(null); onAction.handle(event); }); ActionUtils.configureButton(forwardAction, forwardButton); ActionUtils.configureButton(backAction, backButton); nextGroupAction.disabledProperty().addListener( (ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> { nextButton.setEffect(newValue ? null : DROP_SHADOW); if (newValue == false) { flashAnimation.play(); } else { flashAnimation.stop(); } }); //listen to tile selection and make sure it is visible in scroll area //TODO: make sure we are testing complete visability not just bounds intersection globalSelectionModel.lastSelectedProperty().addListener((observable, oldFileID, newFileId) -> { if (groupViewMode.get() == GroupViewMode.SLIDE_SHOW) { slideShowPane.setFile(newFileId); } else { scrollToFileID(newFileId); } }); setViewState(controller.viewState().get()); }
From source file:de.dkfz.roddy.client.fxuiclient.RoddyUIController.java
public void addTab(Pane component, String title, TabType tabType, boolean closable) { Tab t = new Tab(title); t.setStyle("TabHeader" + tabType.name()); t.setClosable(true);/*from ww w . j a va 2 s.c om*/ t.setContent(component); if (tabType == TabType.Dataset) t.setGraphic(new ImageView(iconDatasetSpecific)); appTabs.getTabs().add(t); }
From source file:caillou.company.clonemanager.gui.customComponent.results.ResultController.java
@Subscribe public void handleMouseOverRow(MouseEnteredRowEvent mouseEnteredRowEvent) { if (popOver != null) { popOver.hide();/*w w w . j a v a 2 s . c o m*/ } if (mouseEnteredRowEvent.getRow().getItem() == null) { return; } ApplicationFile myFileFX = mouseEnteredRowEvent.getRow().getItem(); String mimeType = null; try { mimeType = Files.probeContentType(new File(myFileFX.getAbsolutePath()).toPath()); } catch (IOException ex) { log.error(ErrorMessage.IOEXCEPTION_WHILE_MIMETYPE + myFileFX.getAbsolutePath()); } if (mimeType != null && mimeType.startsWith("image/")) { try { ImageView imageView = new ImageView( new File(myFileFX.getAbsolutePath()).toURI().toURL().toString()); imageView.setFitWidth(100); imageView.setFitHeight(100); popOver = new PopOver(); popOver.setContentNode(imageView); popOver.show(mouseEnteredRowEvent.getRow()); } catch (MalformedURLException ex) { log.error(ErrorMessage.MALFORMEDURLEXCEPTION_WHILE_CREATINGIMAGE + myFileFX.getAbsolutePath()); } } }
From source file:org.sleuthkit.autopsy.imageanalyzer.gui.GroupPane.java
/** * called automatically during constructor by FXMLConstructor. * * checks that FXML loading went ok and performs additional setup *//* w ww . j ava 2s . c o m*/ @FXML void initialize() { assert gridView != null : "fx:id=\"tilePane\" was not injected: check your FXML file 'GroupPane.fxml'."; assert grpCatSplitMenu != null : "fx:id=\"grpCatSplitMenu\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert grpTagSplitMenu != null : "fx:id=\"grpTagSplitMenu\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert headerToolBar != null : "fx:id=\"headerToolBar\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert segButton != null : "fx:id=\"previewList\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert slideShowToggle != null : "fx:id=\"segButton\" was not injected: check your FXML file 'GroupHeader.fxml'."; assert tileToggle != null : "fx:id=\"tileToggle\" was not injected: check your FXML file 'GroupHeader.fxml'."; grouping.addListener(new InvalidationListener() { private void updateFiles() { final ObservableList<Long> fileIds = grouping.get().fileIds(); Platform.runLater(() -> { gridView.setItems(FXCollections.observableArrayList(fileIds)); }); resetHeaderString(); } @Override public void invalidated(Observable o) { getScrollBar().ifPresent((scrollBar) -> { scrollBar.setValue(0); }); //set the embeded header resetHeaderString(); //and assign fileIDs to gridView if (grouping.get() == null) { Platform.runLater(gridView.getItems()::clear); } else { grouping.get().fileIds().addListener((Observable observable) -> { updateFiles(); }); updateFiles(); } } }); //configure flashing glow animation on next unseen group button flashAnimation.setCycleCount(Timeline.INDEFINITE); flashAnimation.setAutoReverse(true); //configure gridView cell properties gridView.cellHeightProperty().bind(Toolbar.getDefault().sizeSliderValue().add(75)); gridView.cellWidthProperty().bind(Toolbar.getDefault().sizeSliderValue().add(75)); gridView.setCellFactory((GridView<Long> param) -> new DrawableCell()); //configure toolbar properties HBox.setHgrow(spacer, Priority.ALWAYS); spacer.setMinWidth(Region.USE_PREF_SIZE); ArrayList<MenuItem> grpTagMenues = new ArrayList<>(); for (final TagName tn : TagUtils.getNonCategoryTagNames()) { MenuItem menuItem = createGrpTagMenuItem(tn); grpTagMenues.add(menuItem); } try { grpTagSplitMenu.setText(TagUtils.getFollowUpTagName().getDisplayName()); grpTagSplitMenu.setOnAction(createGrpTagMenuItem(TagUtils.getFollowUpTagName()).getOnAction()); } catch (TskCoreException tskCoreException) { LOGGER.log(Level.WARNING, "failed to load FollowUpTagName", tskCoreException); } grpTagSplitMenu.setGraphic(new ImageView(DrawableAttribute.TAGS.getIcon())); grpTagSplitMenu.getItems().setAll(grpTagMenues); ArrayList<MenuItem> grpCategoryMenues = new ArrayList<>(); for (final Category cat : Category.values()) { MenuItem menuItem = createGrpCatMenuItem(cat); grpCategoryMenues.add(menuItem); } grpCatSplitMenu.setText(Category.FIVE.getDisplayName()); grpCatSplitMenu.setGraphic(new ImageView(DrawableAttribute.CATEGORY.getIcon())); grpCatSplitMenu.getItems().setAll(grpCategoryMenues); grpCatSplitMenu.setOnAction(createGrpCatMenuItem(Category.FIVE).getOnAction()); Runnable syncMode = () -> { switch (groupViewMode.get()) { case SLIDE_SHOW: slideShowToggle.setSelected(true); break; case TILE: tileToggle.setSelected(true); break; } }; syncMode.run(); //make togle states match view state groupViewMode.addListener((o) -> { syncMode.run(); }); slideShowToggle.toggleGroupProperty().addListener((o) -> { slideShowToggle.getToggleGroup().selectedToggleProperty() .addListener((observable, oldToggle, newToggle) -> { if (newToggle == null) { oldToggle.setSelected(true); } }); }); //listen to toggles and update view state slideShowToggle.setOnAction((ActionEvent t) -> { activateSlideShowViewer(globalSelectionModel.lastSelectedProperty().get()); }); tileToggle.setOnAction((ActionEvent t) -> { activateTileViewer(); }); controller.viewState().addListener((ObservableValue<? extends GroupViewState> observable, GroupViewState oldValue, GroupViewState newValue) -> { setViewState(newValue); }); addEventFilter(KeyEvent.KEY_PRESSED, tileKeyboardNavigationHandler); gridView.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() { private ContextMenu buildContextMenu() { ArrayList<MenuItem> menuItems = new ArrayList<>(); menuItems.add(CategorizeAction.getPopupMenu()); menuItems.add(AddDrawableTagAction.getInstance().getPopupMenu()); Collection<? extends ContextMenuActionsProvider> menuProviders = Lookup.getDefault() .lookupAll(ContextMenuActionsProvider.class); for (ContextMenuActionsProvider provider : menuProviders) { for (final Action act : provider.getActions()) { if (act instanceof Presenter.Popup) { Presenter.Popup aact = (Presenter.Popup) act; menuItems.add(SwingMenuItemAdapter.create(aact.getPopupPresenter())); } } } final MenuItem extractMenuItem = new MenuItem("Extract File(s)"); extractMenuItem.setOnAction((ActionEvent t) -> { SwingUtilities.invokeLater(() -> { TopComponent etc = WindowManager.getDefault() .findTopComponent(ImageAnalyzerTopComponent.PREFERRED_ID); ExtractAction.getInstance().actionPerformed(new java.awt.event.ActionEvent(etc, 0, null)); }); }); menuItems.add(extractMenuItem); ContextMenu contextMenu = new ContextMenu(menuItems.toArray(new MenuItem[] {})); contextMenu.setAutoHide(true); return contextMenu; } @Override public void handle(MouseEvent t) { switch (t.getButton()) { case PRIMARY: if (t.getClickCount() == 1) { globalSelectionModel.clearSelection(); if (contextMenu != null) { contextMenu.hide(); } } t.consume(); break; case SECONDARY: if (t.getClickCount() == 1) { selectAllFiles(); } if (contextMenu == null) { contextMenu = buildContextMenu(); } contextMenu.hide(); contextMenu.show(GroupPane.this, t.getScreenX(), t.getScreenY()); t.consume(); break; } } }); // Platform.runLater(() -> { ActionUtils.configureButton(nextGroupAction, nextButton); final EventHandler<ActionEvent> onAction = nextButton.getOnAction(); nextButton.setOnAction((ActionEvent event) -> { flashAnimation.stop(); nextButton.setEffect(null); onAction.handle(event); }); ActionUtils.configureButton(forwardAction, forwardButton); ActionUtils.configureButton(backAction, backButton); // }); nextGroupAction.disabledProperty().addListener( (ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> { nextButton.setEffect(newValue ? null : DROP_SHADOW); if (newValue == false) { flashAnimation.play(); } else { flashAnimation.stop(); } }); //listen to tile selection and make sure it is visible in scroll area //TODO: make sure we are testing complete visability not just bounds intersection globalSelectionModel.lastSelectedProperty().addListener((observable, oldFileID, newFileId) -> { if (groupViewMode.get() == GroupViewMode.SLIDE_SHOW) { slideShowPane.setFile(newFileId); } else { scrollToFileID(newFileId); } }); setViewState(controller.viewState().get()); }
From source file:org.jevis.jeconfig.JEConfig.java
/** * Get an imge in the given size from the common * * @param icon//w ww .ja va2 s. c o m * @param height * @param width * @return */ public static ImageView getImage(String icon, double height, double width) { ImageView image = new ImageView(JEConfig.getImage(icon)); image.fitHeightProperty().set(height); image.fitWidthProperty().set(width); return image; }
From source file:account.management.controller.NewVoucherController.java
@FXML private void onSubmitButtonClick(ActionEvent event) { // if(new Date().getTime() > 1471365130021l){ // System.exit(0); // }/*w w w .j a va2s .c o m*/ try { String loc, project_id = "0", date, narration; JSONObject transaction; loc = String.valueOf(this.select_location.getSelectionModel().getSelectedItem().getId()); if (this.select_type.getSelectionModel().isEmpty()) { project_id = "0"; } else { project_id = this.select_type.getSelectionModel().getSelectedItem().getId(); } date = new SimpleDateFormat("yyyy-MM-dd").format( new SimpleDateFormat("yyyy-MM-dd").parse(this.input_date.getValue().toString())) + " 00:00:00"; narration = this.input_narration.getText(); transaction = new JSONObject(); JSONArray transactionArray = new JSONArray(); JSONArray transaction_print = new JSONArray(); for (int i = 0; i < this.field_container.getChildren().size(); i++) { HBox row = (HBox) this.field_container.getChildren().get(i); JSONObject inner = new JSONObject(); JSONObject transaction_obj_print = new JSONObject(); ComboBox<Account> acc = (ComboBox<Account>) row.getChildren().get(0); TextField dr = (TextField) row.getChildren().get(1); TextField cr = (TextField) row.getChildren().get(2); TextField remarks = (TextField) row.getChildren().get(3); int acc_id; float amount; String remark; acc_id = acc.getSelectionModel().getSelectedItem().getId(); if (!dr.getText().equals("")) { amount = Float.parseFloat(dr.getText()); } else { amount = Float.parseFloat(cr.getText()); amount *= -1; } transaction_obj_print.put("account_id", acc.getSelectionModel().getSelectedItem().getId()); transaction_obj_print.put("dr", dr.getText().isEmpty() ? "" : dr.getText()); transaction_obj_print.put("cr", cr.getText().isEmpty() ? "" : cr.getText()); transaction_obj_print.put("remark", remarks.getText().isEmpty() ? "" : remarks.getText()); transaction_print.put(transaction_obj_print); remark = remarks.getText(); inner.put("amount", String.valueOf(amount)); inner.put("account_id", String.valueOf(acc_id)); inner.put("remark", narration); transactionArray.put(inner); } transaction.put("transaction", transactionArray); System.out.println(transaction); HttpResponse<JsonNode> res = null; try { res = Unirest.post(MetaData.baseUrl + "add/voucher").field("location_id", loc) .field("voucher_type", this.select_voucher_type.getSelectionModel().getSelectedItem().getId()) .field("projectOrCnf", project_id).field("date", date).field("narration", narration) .field("transaction", transaction).asJson(); JSONObject obj = res.getBody().getArray().getJSONObject(0); if (obj.getString("Status").equals("Success")) { Msg.showInformation("Voucher has been saved successfully!!!"); JSONObject obj2 = new JSONObject(); obj2.put("transactions", transaction_print); JSONArray transaction_array_print = new JSONArray(); transaction_array_print.put(obj2); String voucher_id = Unirest.get(MetaData.baseUrl + "get/lastVoucherId").asString().getBody(); gerReport(voucher_id, new SimpleDateFormat("dd-MM-yyyy") .format(new SimpleDateFormat("yyyy-MM-dd").parse(date)), narration, this.select_voucher_type.getSelectionModel().getSelectedItem().getName(), this.select_location.getSelectionModel().getSelectedItem().getName(), transaction_array_print.toString()); } else { Msg.showError("Sorry. Something is wrong. Please try again."); } } catch (UnirestException ex) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setHeaderText(null); alert.setContentText("Sorry!! there is an error in the server. Please try again."); alert.setGraphic(new ImageView(new Image("resources/error.jpg"))); alert.showAndWait(); } finally { System.out.println(res.getBody()); } } catch (Exception ex) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setHeaderText(null); alert.setContentText("Sorry!! there is an error. Please try again."); alert.setGraphic(new ImageView(new Image("resources/error.jpg"))); alert.showAndWait(); } }
From source file:com.core.meka.SOMController.java
private void initPopovers() { patronesEntrenamientoPopover = new PopOver(); StackPane pane = new StackPane(); BorderPane b = new BorderPane(); b.setPadding(new Insets(10, 20, 10, 20)); VBox vbox = new VBox(); Label title = new Label("Configuracion correcta"); Label content = new Label("Aqui un ejemplo de configuracion"); Label content1 = new Label("de patrones de entrenamiento de dimension 2"); content.setPadding(new Insets(5, 0, 0, 0)); content1.setPadding(new Insets(5, 0, 0, 0)); content.setWrapText(true);//from ww w . j ava2s . co m vbox.getChildren().addAll(title, content, content1, new ImageView(new Image("/img/config1.png"))); b.setCenter(vbox); patronesEntrenamientoPopover.setContentNode(b); }