List of usage examples for javafx.scene.image ImageView ImageView
public ImageView(Image image)
From source file:org.pdfsam.splitbysize.SplitBySizeModule.java
public Node graphic() { return new ImageView("split_by_size.png"); }
From source file:ch.tuason.djbattlescore.lib.components.comps.NowPlayingImageRotator.java
private Label getNowPlayingTitleLabel() { if (titleLabel == null) { Image image = new Image( getClass().getResourceAsStream(DjBattleConstants.IMAGE_RESOURCE_TURNTABLE_LOGO_48)); titleLabel = new Label("Spinning the Decks", new ImageView(image)); titleLabel.setFont(new Font("Arial", 30)); titleLabel.setTextFill(Color.web(DjBattleConstants.COLOR_RESULT_TITLE_TEXT)); }/* w w w.j ava2s . c om*/ return titleLabel; }
From source file:org.pdfsam.split.SplitModule.java
public Node graphic() { return new ImageView("split.png"); }
From source file:org.pdfsam.splitbybookmarks.SplitByBookmarksModule.java
public Node graphic() { return new ImageView("split_by_bookmarks.png"); }
From source file:account.management.controller.inventory.StockReportController.java
@FXML private void onShowClick(ActionEvent event) { this.show.setDisable(true); String start_date = "1980-01-01", end_date = "2050-12-31"; try {//from w w w. j a v a2 s .co m start_date = new SimpleDateFormat("yyyy-MM-dd") .format(new SimpleDateFormat("yyyy-MM-dd").parse(this.start.getValue().toString())); end_date = new SimpleDateFormat("yyyy-MM-dd") .format(new SimpleDateFormat("yyyy-MM-dd").parse(this.end.getValue().toString())); HttpResponse<JsonNode> res = Unirest.get(MetaData.baseUrl + "report/stock") .queryString("start", start_date).queryString("end", end_date).asJson(); JSONArray array = res.getBody().getArray(); Vector v = new Vector(); HashMap params = new HashMap(); params.put("date", "From " + new SimpleDateFormat("dd-MM-yyyy") .format(new SimpleDateFormat("yyyy-MM-dd").parse(start_date)) + " To " + new SimpleDateFormat("dd-MM-yyyy") .format(new SimpleDateFormat("yyyy-MM-dd").parse(end_date))); for (int i = 0; i < array.length(); i++) { JSONObject obj = array.getJSONObject(i); String id = String.valueOf(obj.getInt("item_id")); String name = getProductName(Integer.parseInt(id)); String opening_qty = obj.get("opening_qty").toString(); String opening_price = obj.get("opening_price").toString() == "null" ? "0.0" : obj.get("opening_price").toString(); String p_qty = obj.get("p_qty").toString() == "null" ? "0.0" : obj.get("p_qty").toString(); String p_price = obj.get("p_price").toString() == "null" ? "0.0" : obj.get("p_price").toString(); String s_qty = obj.get("s_qty").toString() == "null" ? "0.0" : obj.get("s_qty").toString(); String s_price = obj.get("s_price").toString() == "null" ? "0.0" : obj.get("s_price").toString(); String closing_qty = String .valueOf(Float.parseFloat(opening_qty) + Float.parseFloat(p_qty) - Float.parseFloat(s_qty)); String closing_total = String.valueOf( Float.parseFloat(opening_price) + Float.parseFloat(p_price) - Float.parseFloat(s_price)); String closing_rate = String .valueOf(Float.parseFloat(closing_total) / Float.parseFloat(closing_qty)); v.add(new Stock(0, id, name, opening_qty, String.valueOf(Float.parseFloat(opening_price) / Float.parseFloat(opening_qty)), opening_price, closing_qty, closing_rate, closing_total)); } Report report = new Report(); report.getReport("src\\report\\StockReport.jrxml", new JRBeanCollectionDataSource(v), params, "Stock Report"); this.show.setDisable(false); } catch (Exception ex) { Logger.getLogger(StockReportController.class.getName()).log(Level.SEVERE, null, 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:ch.tuason.djbattlescore.lib.components.comps.ResultGridPane.java
private Label getResultTitleLabel() { if (resultTitleLabel == null) { Image image = new Image( getClass().getResourceAsStream(DjBattleConstants.IMAGE_RESOURCE_TURNTABLE_LOGO_48)); resultTitleLabel = new Label("Current Ranking", new ImageView(image)); resultTitleLabel.setFont(new Font("Arial", 30)); resultTitleLabel.setTextFill(Color.web(DjBattleConstants.COLOR_RESULT_TITLE_TEXT)); }// w w w. j av a 2 s . co m return resultTitleLabel; }
From source file:photobooth.views.ExplorerPane.java
private BorderPane createImageView(final File imageFile) { // DEFAULT_THUMBNAIL_WIDTH is a constant you need to define // The last two arguments are: preserveRatio, and use smooth (slower) // resizing/*from w ww .ja v a 2 s. co m*/ ExplorerPane explorerPane = this; ImageView imageView = null; BorderPane borderPane = new BorderPane(); try { borderPane.setMaxSize(100, 100); borderPane.setMinSize(100, 100); FileInputStream fileInputStream = new FileInputStream(imageFile); final Image image = new Image(fileInputStream, 100, 100, true, true); imageView = new ImageView(image); fileInputStream.close(); imageView.getStyleClass().add("image-view"); borderPane.setCenter(imageView); //imageView.setFitWidth(80); imageView.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) { if (mouseEvent.getClickCount() == 1) { Global.getInstance().setSceneRoot(LoadingPane.getInstance()); Platform.runLater(() -> { new Thread(new Runnable() { @Override public void run() { ImagePane.getInstance().init(explorerPane, imageFile); Global.getInstance().setSceneRoot(ImagePane.getInstance()); } }).start(); }); } } } }); } catch (FileNotFoundException ex) { ex.printStackTrace(); } catch (IOException ex) { Logger.getLogger(ExplorerPane.class.getName()).log(Level.SEVERE, null, ex); } return borderPane; }
From source file:cz.lbenda.gui.controls.TextAreaFrmController.java
/** Create button which can open text editor */ public static Button createOpenButton(String windowTitle, @Nonnull Supplier<String> oldValueSupplier, @Nonnull Consumer<String> newValueConsumer) { String title = windowTitle == null ? msgDefaultWindowTitle : windowTitle; Button result = new Button(null, new ImageView(BUTTON_IMAGE)); result.setTooltip(new Tooltip(msgBtnOpenInEditor_tooltip)); BorderPane.setAlignment(result, Pos.TOP_RIGHT); result.setOnAction(event -> {/*ww w. j a v a2 s . c om*/ Tuple2<Parent, TextAreaFrmController> tuple2 = TextAreaFrmController.createNewInstance(); tuple2.get2().textProperty().setValue(oldValueSupplier.get()); tuple2.get2().textProperty() .addListener((observable, oldValue, newValue) -> newValueConsumer.accept(newValue)); Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow(); DialogHelper.getInstance().openWindowInCenterOfStage(stage, tuple2.get2().getMainPane(), title); }); return result; }
From source file:account.management.controller.inventory.ProductWiseInventoryReportController.java
@FXML private void onShowReportClick(ActionEvent event) { this.show.setDisable(true); try {/*w w w . j av a 2 s . co m*/ String id = String.valueOf(this.item.getSelectionModel().getSelectedItem().getId()); String start_date = "1980-01-01", end_date = "2050-12-31"; start_date = new SimpleDateFormat("yyyy-MM-dd") .format(new SimpleDateFormat("yyyy-MM-dd").parse(this.start.getValue().toString())); end_date = new SimpleDateFormat("yyyy-MM-dd") .format(new SimpleDateFormat("yyyy-MM-dd").parse(this.end.getValue().toString())); HttpResponse<JsonNode> res = Unirest.get(MetaData.baseUrl + "report/product/sellPurchase") .queryString("id", id).queryString("start", start_date).queryString("end", end_date).asJson(); JSONArray array = res.getBody().getArray(); Vector v = new Vector(); HashMap params = new HashMap(); params.put("date", "From " + new SimpleDateFormat("dd-MM-yyyy") .format(new SimpleDateFormat("yyyy-MM-dd").parse(start_date)) + " To " + new SimpleDateFormat("dd-MM-yyyy") .format(new SimpleDateFormat("yyyy-MM-dd").parse(end_date))); params.put("item_name", "Inventory report of " + this.item.getSelectionModel().getSelectedItem().getName()); float total_p_qty = 0, total_s_qty = 0; double total_p_param = 0; for (int i = 0; i < array.length(); i++) { JSONObject obj = array.getJSONObject(i); String date = obj.getString("date"); date = new SimpleDateFormat("dd-MM-yyyy").format(new SimpleDateFormat("yyyy-MM-dd").parse(date)); String p_qty = obj.get("p_qty").toString() == "null" ? "-" : obj.get("p_qty").toString(); String p_rate = obj.get("p_rate").toString() == "null" ? "-" : obj.get("p_rate").toString(); String p_price = obj.get("p_total").toString() == "null" ? "-" : obj.get("p_total").toString(); String s_qty = obj.get("s_qty").toString() == "null" ? "-" : obj.get("s_qty").toString(); String s_rate = obj.get("s_rate").toString() == "null" ? "-" : obj.get("s_rate").toString(); String s_price = obj.get("s_total").toString() == "null" ? "-" : obj.get("s_total").toString(); System.out.println(s_price); v.add(new IndividualProductReport(date, p_qty, p_rate, p_price, s_qty, s_rate, s_price)); if (!p_qty.equals("-")) { total_p_qty += Float.parseFloat(p_qty); } if (!s_qty.equals("-")) { total_s_qty += Float.parseFloat(s_qty); } if (!p_price.equals("-")) { total_p_param += Float.parseFloat(p_price); } } params.put("closing_qty", String.valueOf(total_p_qty - total_s_qty)); System.out.println(total_p_qty); params.put("closing_rate", String.valueOf(total_p_param / total_p_qty)); params.put("closing_total", String.valueOf((total_p_qty - total_s_qty) * (total_p_param / total_p_qty))); Report report = new Report(); report.getReport("src\\report\\IndiviualProductPurchaseSellReport.jrxml", new JRBeanCollectionDataSource(v), params, "Product Wise Inventory Report"); this.show.setDisable(false); } catch (Exception e) { System.out.println("Exception in show report button click"); 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:ca.wumbo.doommanager.client.controller.file.DoomFileController.java
@FXML private void initialize() { // Keep the left window the same size when resizing/maximizing. SplitPane.setResizableWithParent(leftBorderPane, false); // Allow selection of multiple cells. entryTreeTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); // Make the cells update accordingly. nameColumn.setCellValueFactory(cellData -> cellData.getValue().getValue().entryProperty()); sizeColumn.setCellValueFactory(cellData -> cellData.getValue().getValue().dataLengthStringProperty()); typeColumn.setCellValueFactory(cellData -> cellData.getValue().getValue().entryTypeProperty()); // Resize the splitter to a reasonable position. // Since we can't use Platform.runlater() to do this, we have to use a listener that removes itself. // Note: The old way it was done was to pass the tabPane's width to the function after this is initialized. InvalidationListener invalidationListener = new InvalidationListener() { @Override//from w w w. j a v a2 s .com public void invalidated(Observable observable) { setSplitterPosition((int) splitPane.getWidth()); splitPane.widthProperty().removeListener(this); // Remove itself after the size is set. } }; splitPane.widthProperty().addListener(invalidationListener); // Handle item selection. This will clean up our GUI and add/remove panes on the right of the splitter. entryTreeTable.getSelectionModel().selectedItemProperty().addListener((obsValue, oldValue, newValue) -> { updateGUIFromEntrySelection(oldValue, newValue); }); // Support right clicking menus on the rows, source: https://gist.github.com/james-d/7758918 entryTreeTable.setRowFactory(new Callback<TreeTableView<Entry>, TreeTableRow<Entry>>() { @Override public TreeTableRow<Entry> call(TreeTableView<Entry> tableView) { // Create the row to return. TreeTableRow<Entry> row = new TreeTableRow<>(); ContextMenu contextMenu = new ContextMenu(); // Whenever this row gets a new item (or is updated), rebuild the right click menu. row.itemProperty().addListener((observableValue, oldValue, newValue) -> { // TODO - Dynamically generate a new context menu - contextMenu.getItems().add(new MenuItem()); }); // Set context menu on row, but use a binding to make it only show for non-empty rows: row.contextMenuProperty() .bind(Bindings.when(row.emptyProperty()).then((ContextMenu) null).otherwise(contextMenu)); return row; } }); // Instead of assigning graphics to each node, only do it for the cells. // This should help reduce object creation by having it only required for the visible rows. nameColumn.setCellFactory(new Callback<TreeTableColumn<Entry, Entry>, TreeTableCell<Entry, Entry>>() { @Override public TreeTableCell<Entry, Entry> call(TreeTableColumn<Entry, Entry> param) { return new TreeTableCell<Entry, Entry>() { @Override protected void updateItem(Entry item, boolean empty) { super.updateItem(item, empty); if (!empty && item != null) { setText(item.getName()); Image img = resources.getImage(item.getClass().getSimpleName().toLowerCase()); setGraphic(new ImageView(img)); } else { setText(null); setGraphic(null); } } }; } }); }