List of usage examples for javafx.scene.image ImageView setSmooth
public final void setSmooth(boolean value)
From source file:jlotoprint.MainViewController.java
public static void loadAboutWindow() { //setup/*from w w w .j a v a 2s . c om*/ Dialog dialog = new Dialog<>(); dialog.getDialogPane().getButtonTypes().add(ButtonType.CLOSE); dialog.setTitle("About JLotoPanel"); dialog.setHeaderText("JLotoPanel v1.0"); ImageView icon = new ImageView("file:resources/icon.png"); icon.setSmooth(true); icon.setFitHeight(48.0); icon.setFitWidth(48.0); dialog.setGraphic(icon); dialog.initModality(Modality.APPLICATION_MODAL); dialog.initOwner(JLotoPrint.stage.getScene().getWindow()); //content GridPane grid = new GridPane(); grid.setPadding(new Insets(10, 10, 0, 10)); //text TextArea textArea = new TextArea("For more info, please visit: https://github.com/mbppower/JLotoPanel"); textArea.setWrapText(true); grid.add(textArea, 0, 0); dialog.getDialogPane().setContent(grid); dialog.showAndWait(); }
From source file:com.imesha.imageprocessor.controllers.MainController.java
/** * Show a given BufferedImage in the UI. * * @param bufferedImage The image to be shown in the UI * @param imageView The JavaFX ImageView element in which the BufferedImage to be shown. *//* ww w.j av a 2 s. co m*/ private static void showImageInUI(final BufferedImage bufferedImage, final ImageView imageView) { Platform.runLater(new Runnable() { public void run() { Image loadedImage = SwingFXUtils.toFXImage(bufferedImage, null); imageView.setImage(loadedImage); imageView.setPreserveRatio(true); imageView.setSmooth(true); imageView.setCache(true); } }); }
From source file:vkmanager.controller.PhotosDetailedController.java
public void showPhotosFromAlbum(VKPhotoAlbum album, int userId) { this.album = album; idForDownload = album.getId();/*from www . j a va 2 s. c om*/ albumDescription.setText(album.getDescription()); photos = vkapi.getPhotosFromAlbum(idForDownload, userId); int i = 0; int j = 0; gridPaneDetailed.addRow(0); for (VKPhoto photo : photos) { Image photoThumbLink = new Image(photo.getLink_s()); ImageView photoThumb = new ImageView(photoThumbLink); photoThumb.setFitHeight(160); photoThumb.setFitWidth(240); photoThumb.setPreserveRatio(true); photoThumb.setSmooth(true); photoThumb.setCache(true); Button photoButt = new Button(); photoButt.setGraphic(photoThumb); photoButt.setStyle("-fx-background-color: white;"); photoButt.setMinSize(240, 160); photoButt.setAlignment(Pos.CENTER); BorderPane bp = new BorderPane(null, photoButt, null, null, null); gridPaneDetailed.add(bp, j, i); j++; if (j == 3) { i++; j = 0; gridPaneDetailed.addRow(i); } } }
From source file:TimeShift.Picture.java
private ImageView getImage() { ImageView imgView; String thmbFile = file.getParent() + "\\thmb\\" + FilenameUtils.getBaseName(file.getName()) + "_thmb.jpg"; imgView = new ImageView(new File(thmbFile).toURI().toString()); imgView.setPreserveRatio(true);/*ww w . j a va2s. c om*/ imgView.setSmooth(true); imgView.setCache(true); return imgView; }
From source file:uk.ac.bris.cs.scotlandyard.ui.controller.BaseGame.java
BaseGame(ResourceManager manager, Stage stage) { this.resourceManager = manager; this.stage = stage; Controller.bind(this); // initialise all controllers travelLog = new TravelLog(resourceManager, config); ticketsCounter = new TicketsCounter(resourceManager, config); notifications = new Notifications(resourceManager, config); status = new Status(resourceManager, config); board = new Board(resourceManager, notifications, config); Rectangle clip = new Rectangle(); clip.widthProperty().bind(gamePane.widthProperty()); clip.heightProperty().bind(gamePane.heightProperty()); gamePane.setClip(clip);/* w w w .j av a 2 s.c o m*/ // system menu menu.setUseSystemMenuBar(true); // add all views mapPane.getChildren().add(board.root()); roundsPane.getChildren().add(travelLog.root()); playersPane.getChildren().add(ticketsCounter.root()); notificationPane.getChildren().add(notifications.root()); statusPane.getChildren().add(status.root()); close.setOnAction(e -> stage.close()); debug.setOnAction(evt -> { try { Debug.showDebugger(stage); } catch (Exception e) { Utils.handleFatalException(e); } }); about.setOnAction(e -> { Alert alert = new Alert(AlertType.INFORMATION, "ScotlandYard is part of the CW-MODEL coursework prepared for University of Bristol course COMS100001", ButtonType.OK); ImageView logo = new ImageView(resourceManager.getImage(ImageResource.UOB_LOGO)); logo.setPreserveRatio(true); logo.setSmooth(true); logo.setFitHeight(100); alert.setGraphic(logo); alert.setTitle("About ScotlandYard"); alert.setHeaderText("ScotlandYard v0.1"); alert.show(); }); findNode.setOnAction(e -> { Stage s = new Stage(); s.setTitle("Find node"); s.setScene(new Scene(new FindNode(config, s, resourceManager).root())); s.show(); }); manual.setOnAction(e -> { Stage s = new Stage(); s.setTitle("Manual"); s.setScene(new Scene(new Manual(s).root())); s.show(); }); license.setOnAction(e -> { Stage s = new Stage(); s.setTitle("License"); s.setScene(new Scene(new License(s).root())); s.show(); }); // bind all menu values resetViewport.setOnAction(e -> { board.resetViewport(); }); setAndBind(travelLog.root().visibleProperty(), travelLogToggle.selectedProperty()); setAndBind(ticketsCounter.root().visibleProperty(), ticketToggle.selectedProperty()); setAndBind(config.scrollPanProperty(), scrollToggle.selectedProperty()); setAndBind(config.historyProperty(), historyToggle.selectedProperty()); setAndBind(config.focusPlayerProperty(), focusToggle.selectedProperty()); if (SystemUtils.IS_OS_WINDOWS) config.scrollPanProperty().setValue(false); }
From source file:fruitproject.FruitProject.java
public void second(final String pfname) { final Stage st = new Stage(); Scene scene = null;//from w ww . j a v a 2 s . co m final GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); TableView tv = new TableView(); final TableColumn<Map, String> firstDataColumn = new TableColumn<>("Name"); final TableColumn<Map, String> secondDataColumn = new TableColumn<>("Amount"); final TableColumn<Map, String> thirdDataColumn = new TableColumn<>("Remove"); firstDataColumn.setMinWidth(130); secondDataColumn.setMinWidth(130); thirdDataColumn.setMinWidth(130); if (!pfname.equals("")) { firstDataColumn.setCellValueFactory(new MapValueFactory(Column1MapKey)); secondDataColumn.setCellValueFactory(new MapValueFactory(Column2MapKey)); thirdDataColumn.setCellValueFactory(new MapValueFactory(Column3MapKey)); rows = 0; tv = new TableView<>(generateDataInMap(pfname, addPairs)); } tv.getColumns().setAll(firstDataColumn, secondDataColumn, thirdDataColumn); // secondDataColumn.setCellFactory(TextFieldTableCell.forTableColumn()); ScrollPane sp = new ScrollPane(); sp.setMinWidth(400); sp.setHbarPolicy(ScrollBarPolicy.NEVER); sp.setContent(tv); grid.add(sp, 0, 3); final ComboBox comboBox = new ComboBox(); HBox hb1 = new HBox(); comboBox.setValue("FILE"); comboBox.getItems().addAll("Save this file", "Load a new file"); Button btnOk = new Button(); btnOk.setText("OK"); hb1.getChildren().addAll(comboBox, btnOk); hb1.setSpacing(10); grid.add(hb1, 0, 1); Label label1 = new Label("Title:"); final TextField tfFilename = new TextField(); tfFilename.setText(getTitle(pfname)); HBox hb = new HBox(); hb.getChildren().addAll(label1, tfFilename); hb.setSpacing(10); grid.add(hb, 0, 2); final Stage ps = new Stage(); final TableView tv1 = tv; btnOk.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { //System.out.println("Hello World!"); if (comboBox.getValue().equals("Load a new file")) { first(ps); st.close(); } else { PrintWriter pw = null; try { pw = new PrintWriter("abc.json"); BufferedWriter bw = new BufferedWriter(new FileWriter(pfname, false)); bw.write("{title:\"" + tfFilename.getText() + "\""); bw.write(",fruits:["); for (int i = 0; i < rows; i++) { bw.write("{name:\"" + String.valueOf(firstDataColumn.getCellData(i)) + "\",amount:" + String.valueOf(secondDataColumn.getCellData(i)) + "}"); if (i != rows - 1) bw.write(","); } bw.write("]}"); bw.close(); } catch (Exception e) { System.out.println(e.toString()); } } } }); Button btn = new Button(); btn.setText("New Fruit"); grid.add(btn, 1, 2); // TableView tv=new TableView(); // TableColumn Col1 = new TableColumn("Name"); // TableColumn Col2 = new TableColumn("Amount"); // TableColumn Col3 = new TableColumn("Remove"); // tv.getColumns().addAll(Col1, Col2, Col3); //sp.setFitToWidth(true); Image img = new Image("file:music.jpg"); ImageView iv2 = new ImageView(); iv2.setImage(img); iv2.setFitWidth(200); iv2.setPreserveRatio(true); iv2.setSmooth(true); iv2.setCache(true); grid.add(iv2, 1, 3); btn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { //System.out.println("Hello World!"); System.out.println(comboBox.valueProperty()); st.close(); third(pfname); } }); scene = new Scene(grid, 700, 450); st.setScene(scene); st.show(); }
From source file:AudioPlayer3.java
private ImageView createAlbumCover() { final Reflection reflection = new Reflection(); reflection.setFraction(0.2);//from w ww. j a v a 2 s . c om final ImageView albumCover = new ImageView(); albumCover.setFitWidth(240); albumCover.setPreserveRatio(true); albumCover.setSmooth(true); albumCover.setEffect(reflection); return albumCover; }