List of usage examples for javafx.scene.image ImageView ImageView
public ImageView(Image image)
From source file:cz.lbenda.rcp.IconFactory.java
/** Return image view for given base name. The icon is get from caller class */ public <T> ImageView imageView(T caller, @Nonnull String baseName, @Nonnull IconLocation location) { return new ImageView(image(caller, baseName, location.getIconSize())); }
From source file:account.management.controller.inventory.StockReportController.java
@Override public void initialize(URL url, ResourceBundle rb) { product_list = FXCollections.observableArrayList(); try {//from w w w.j ava 2 s . c o m HttpResponse<JsonNode> res = Unirest.get(MetaData.baseUrl + "all/products").asJson(); JSONArray array = res.getBody().getArray(); for (int i = 0; i < array.length(); i++) { JSONObject obj = array.getJSONObject(i); int id = obj.getInt("id"); String name = obj.getString("name"); float p_qty = Float.parseFloat(obj.get("p_qty").toString()); float s_qty = Float.parseFloat(obj.get("s_qty").toString()); double last_p_rate = obj.getDouble("last_p_rate"); double last_s_rate = obj.getDouble("last_s_rate"); double avg_p_rate = obj.getDouble("avg_p_rate"); double avg_s_rate = obj.getDouble("avg_s_rate"); product_list .add(new Product(id, name, p_qty, s_qty, last_p_rate, last_s_rate, avg_p_rate, avg_s_rate)); } } catch (Exception e) { 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(); } }
From source file:account.management.controller.inventory.ProductWiseInventoryReportController.java
/** * Initializes the controller class.// ww w .ja va 2 s. c o m */ @Override public void initialize(URL url, ResourceBundle rb) { new AutoCompleteComboBoxListener<>(item); item.setOnHiding((e) -> { Product a = item.getSelectionModel().getSelectedItem(); item.setEditable(false); item.getSelectionModel().select(a); }); item.setOnShowing((e) -> { item.setEditable(true); }); // get product list products_list = FXCollections.observableArrayList(); try { HttpResponse<JsonNode> res = Unirest.get(MetaData.baseUrl + "all/products").asJson(); JSONArray array = res.getBody().getArray(); for (int i = 0; i < array.length(); i++) { JSONObject obj = array.getJSONObject(i); int id = obj.getInt("id"); String name = obj.getString("name"); products_list.add(new Product(id, name)); } this.item.getItems().addAll(products_list); } catch (Exception e) { 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(); } }
From source file:com.playonlinux.ui.impl.javafx.mainwindow.center.ViewApps.java
private void initFailure() { failurePanel = new VBox(); failurePanel.getStyleClass().add("rightPane"); failurePanel.setSpacing(10);//from w ww.j av a 2s. co m failurePanel.setAlignment(Pos.CENTER); Label failureNotificationLbl = new Label(); failureNotificationLbl.setText(translate( "Connecting to ${application.name} failed.\n" + "Please check your connection and try again.")); failureNotificationLbl.setTextAlignment(TextAlignment.CENTER); ImageView retryImage = new ImageView(new Image(getClass().getResourceAsStream("refresh.png"))); retryImage.setFitWidth(16); retryImage.setFitHeight(16); retryButton = new Button(translate("Retry"), retryImage); failurePanel.getChildren().addAll(failureNotificationLbl, retryButton); }
From source file:photobooth.views.EmailPane.java
private void addXButton() { Button button = new Button(); try {/* www . j av a 2s. com*/ button.setGraphic( new ImageView(new Image(getClass().getResource("/photobooth/images/exit.png").openStream()))); } catch (IOException ex) { Logger.getLogger(EmailPane.class.getName()).log(Level.SEVERE, null, ex); } button.setStyle("-fx-background-color: transparent;"); button.setLayoutX(730); button.setLayoutY(10); button.setMaxSize(50, 50); button.setMinSize(50, 50); button.getStyleClass().add("blueButton"); this.getChildren().add(button); button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { t.cancel(); t.purge(); Global.getInstance().setSceneRoot(HomePane.getInstance()); } }); }
From source file:de.perdian.apps.tagtiger.fx.handlers.batchupdate.UpdateFileNamesFromTagsActionEventHandler.java
@Override protected BatchUpdateDialog createDialog() { ObservableList<UpdateFileNamesFromTagsItem> items = FXCollections.observableArrayList( this.getOtherFiles().stream().map(UpdateFileNamesFromTagsItem::new).collect(Collectors.toList())); StringProperty patternFieldProperty = new SimpleStringProperty(); List<String> patternItems = Arrays.asList("${track} ${title}"); ComboBox<String> patternBox = new ComboBox<>(FXCollections.observableArrayList(patternItems)); patternBox.setEditable(true);/*from w ww .j a v a 2 s .c om*/ patternBox.setMaxWidth(Double.MAX_VALUE); Bindings.bindBidirectional(patternFieldProperty, patternBox.editorProperty().get().textProperty()); HBox.setHgrow(patternBox, Priority.ALWAYS); Button executeButton = new Button(this.getLocalization().executeRename(), new ImageView(new Image(UpdateFileNamesFromTagsActionEventHandler.class.getClassLoader() .getResourceAsStream("icons/16/save.png")))); executeButton.setDisable(true); patternFieldProperty .addListener((o, oldValue, newValue) -> executeButton.setDisable(newValue.length() <= 0)); HBox patternFieldPane = new HBox(10, patternBox, executeButton); patternFieldPane.setPadding(new Insets(5, 5, 5, 5)); TitledPane patternFieldTitlePane = new TitledPane(this.getLocalization().fileNamePattern(), patternFieldPane); patternFieldTitlePane.setCollapsible(false); TableView<?> newFileNamesPane = this.createNewFileNamesPane(items); newFileNamesPane.setPrefHeight(400); VBox.setVgrow(newFileNamesPane, Priority.ALWAYS); VBox actionPane = new VBox(10, patternFieldTitlePane, newFileNamesPane); // Create the dialog and finish BatchUpdateDialog dialog = new BatchUpdateDialog(); dialog.setDialogPrefWidth(800); dialog.setDialogTitle(this.getLocalization().updateFileNames()); dialog.setActionPane(actionPane); dialog.setLegendPane(this.createLegendPane()); // Add listeners this.getOtherFiles().addListener( new WeakListChangeListener<>((Change<? extends TaggableFile> change) -> items.setAll(change .getList().stream().map(UpdateFileNamesFromTagsItem::new).collect(Collectors.toList())))); patternFieldProperty.addListener((o, oldValue, newValue) -> this.computeNewFileNames(items, newValue)); executeButton.setOnAction(event -> { this.updateNewFileNames(items); ((Stage) executeButton.getScene().getWindow()).close(); }); return dialog; }
From source file:com.daarons.control.DeleteTableCell.java
@Override public void updateItem(String delete, boolean empty) { super.updateItem(delete, empty); if (empty) {//from w w w.j a v a 2s .com setGraphic(null); } else { deleteButton.setGraphic(new ImageView(TRASHCAN_IMAGE)); setGraphic(deleteButton); } }
From source file:account.management.controller.EditLocationController.java
@FXML private void onUpdateButtonClick(ActionEvent event) { try {// ww w.ja v a 2s . co m int id = this.location_select.getSelectionModel().getSelectedItem().getId(); String name = this.name_input.getText(); String details = this.details_input.getText(); JSONArray response = Unirest.post(MetaData.baseUrl + "edit/location").queryString("id", id) .queryString("name", name).queryString("details", details).asJson().getBody().getArray(); Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setHeaderText(null); alert.setContentText("Location has been updated successfully!"); alert.setGraphic(new ImageView(new Image("resources/success.jpg"))); alert.showAndWait(); //this.update_button.getScene().getWindow().hide(); } catch (Exception 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(); } }
From source file:ijfx.core.icon.DefaultFXIconService.java
@Override public Node getIconAsNode(String iconPath) { if (iconPath == null) { return null; }//w ww. j a v a 2 s. co m if ("".equals(iconPath)) { return null; } if (fontawesomeIconEquivalent.containsKey(iconPath)) { return getIconAsNode(fontawesomeIconEquivalent.get(iconPath)); } else if (iconPath.startsWith("fa:")) { try { return new FontAwesomeIconView(getIcon(iconPath)); } catch (Exception e) { logger.log(Level.WARNING, String.format("Couldn't load FA icon : %s", iconPath.substring(3).toUpperCase())); return new FontAwesomeIconView(FontAwesomeIcon.REMOVE); } } else { ImageView imageView = new ImageView(iconPath); imageView.getStyleClass().add("image-icon"); return imageView; } }
From source file:com.advos.notehub.client.util.sandsoft.CustomHTMLEditor.java
/** * Creates Custom ToolBar buttons and other controls *//*ww w. ja va2s.com*/ private void createCustomButtons() { //add embed file button ImageView graphic = new ImageView(new Image(getClass().getResourceAsStream(IMPORT_BUTTON_GENERAL))); mImportFileButton = new Button("Import File", graphic); mImportFileButton.setTooltip(new Tooltip("Import File")); mImportFileButton.setOnAction((event) -> onImportFileButtonAction()); //add to top toolbar mTopToolBar.getItems().add(mImportFileButton); mTopToolBar.getItems().add(new Separator(Orientation.VERTICAL)); }