scrollpane

adding images to a gridpane javafx

非 Y 不嫁゛ 提交于 2019-12-02 10:22:14
问题 I'm adding a list of images from a directory using an arraylist.When images are added,my ScrollPane gets crowded.How can I keep spacings between images ? here's my code File file = new File("D:\\SERVER\\Server Content\\Apps\\icons"); File[] filelist1 = file.listFiles(); ArrayList<File> filelist2 = new ArrayList<>(); hb = new HBox(); for (File file1 : filelist1) { filelist2.add(file1); } System.out.println(filelist2.size()); gridpane.setPadding(new Insets(50,50,50,50)); gridpane.setHgap(20);

adding images to a gridpane javafx

拥有回忆 提交于 2019-12-02 05:55:50
I'm adding a list of images from a directory using an arraylist.When images are added,my ScrollPane gets crowded.How can I keep spacings between images ? here's my code File file = new File("D:\\SERVER\\Server Content\\Apps\\icons"); File[] filelist1 = file.listFiles(); ArrayList<File> filelist2 = new ArrayList<>(); hb = new HBox(); for (File file1 : filelist1) { filelist2.add(file1); } System.out.println(filelist2.size()); gridpane.setPadding(new Insets(50,50,50,50)); gridpane.setHgap(20); gridpane.setVgap(20); int imageCol = 0; int imageRow = 0; for (int i = 0; i < filelist2.size(); i++) {

Java JTextPane + JScrollPane: de/activate automatic scrolling

北慕城南 提交于 2019-12-02 04:41:10
问题 I'm currently writing a simple chat in Java and currently I'm stuck on this problem: I want my output JTextPane to behave like you would expect it to from a good chat, ie by default the text scrolls automatically when new text arrives (using outputfield.setCaretPosition(outputdocument.getLength())), but when the user scrolls up this should be disabled and of course re-enabled when the user scrolls to the bottom again. I tried toying around with the ScrollBars and all, but I can't seem to find

JavaFX setFitHeight()/setFitWidth() for an image used within a scrollPane disables panning

天大地大妈咪最大 提交于 2019-12-02 00:56:55
So I am creating a map in JavaFX and I would like to have the whole map visible at times. However, the issue is that after I set the imageView to fit the screen size then adding it to the scrollPane my zoom function works fine, but once I zoom in I am not allowed to pan around the image. Below is the code that I have written. package gameaspects; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.ScrollPane; import javafx.scene.control.ScrollPane.ScrollBarPolicy; import javafx.scene

Always visible when scrolled anchored Node in Java FX 2.0?

被刻印的时光 ゝ 提交于 2019-12-01 12:31:25
问题 I want to make a node present in a ScrollPane anchored to the top (fixed on the Y axis) but capable of scrolling in the X axis. (In Java-FX 2.0) Is this possible? 回答1: You can use binding to adjust this special object position based on scrollbar position, see next code: public class FancyScrollPane extends Application { @Override public void start(Stage primaryStage) { ScrollPane scrollPane = new ScrollPane(); Pane content = new Pane(); scrollPane.setContent(content); // adding background

Zooming in JavaFx: ScrollEvent is consumed when content size exceeds ScrollPane viewport

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 13:40:30
I have an application that requires zoom inside a ScrollPane, but with my current approach I'm still facing 2 challenges. In order to replicate the problem, I have written a small application ZoomApp that you will find the code for underneath. Its' limited functionality allows zooming in and out (using Ctrl + Mouse Wheel) on some arbitrary shapes. When the zoomed content grows outside the bounds of the window, scroll bars should apperar. Challenge 1. When the scroll bars appears as a consequence of innerGroup scales up in size, the ScrollEvent no longer reach my ZoomHandler. Instead, we start

Zooming in JavaFx: ScrollEvent is consumed when content size exceeds ScrollPane viewport

跟風遠走 提交于 2019-11-29 18:40:19
问题 I have an application that requires zoom inside a ScrollPane, but with my current approach I'm still facing 2 challenges. In order to replicate the problem, I have written a small application ZoomApp that you will find the code for underneath. Its' limited functionality allows zooming in and out (using Ctrl + Mouse Wheel) on some arbitrary shapes. When the zoomed content grows outside the bounds of the window, scroll bars should apperar. Challenge 1. When the scroll bars appears as a

JavaFx 8 - Scaling / zooming ScrollPane relative to mouse position

别等时光非礼了梦想. 提交于 2019-11-29 04:39:12
I need to zoom in / out on a scroll pane, relative to the mouse position. I currently achieve the zooming functionality by wrapping my content in a Group, and scaling the group itself. I create a new Scale object with a custom pivot. (Pivot is set to the mouse position) This works perfectly for where the Group's initial scale is 1.0, however scaling afterwards does not scale in the correct direction - I believe this is because the relative mouse position changes when the Group has been scaled. My code: @Override public void initialize(URL location, ResourceBundle resources) { Delta initial

JavaFX ScrollPane border and background

大兔子大兔子 提交于 2019-11-28 21:34:15
I'm having some problem regarding the default background and border of the ScrollPane. Using this style made the problem clearer to see. setStyle("-fx-background-color:blue; -fx-border-color:crimson;"); I've tried this style and got no luck only the red border gone and left me with the blue one. setStyle("-fx-background-color:blue; -fx-background-insets:0; -fx-border-color:crimson; -fx-border-width:0; -fx-border-insets:0;"); I've looked at this old post JavaFX Hide ScrollPane gray border and http://docs.oracle.com/javafx/2/ui_controls/editor.htm This line of code doesn't work neither

How to resize JavaFX ScrollPane content to fit current size

岁酱吖の 提交于 2019-11-27 20:59:34
I have a BorderPane with a ScrollPane as the center element. It resizes automatically to fill the screen. Inside the ScrollPane is a HBox that has no content but is a drag-and-drop target. Therefore I want it to fill its parent ScrollPane . What is the preferred way to do this? What I have tried so far is overriding the ScrollPane.resize(...) method to resize the HBox but it seems rather complicated and unorthodox. edit: To add some useful code to this, this is how I can workaround the problem, but I believe there has to be some better way to do this: @Override public void resize(double width,