keep spacings between images when adding to scrollpane

keep spacings between images when adding to scrollpane

!alt textI'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++) { System.out.println(filelist2.get(i).getName()); image = new Image(filelist2.get(i).toURI().toString());

pic = new ImageView(); pic.setFitWidth(130); pic.setFitHeight(130);

pic.setImage(image); hb.getChildren().add(pic); gridpane.add(pic, imageCol, imageRow );

imageCol++;

// To check if all the 4 images of a row are completed if(imageCol > 2){ // Reset Column imageCol=0; // Next Row imageRow++;

}

View Answers

Ads









Related Tutorials/Questions & Answers:
keep spacings between images when adding to scrollpane
keep spacings between images when adding to scrollpane  !alt textI'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
keep spacings between images when adding to scrollpane
keep spacings between images when adding to scrollpane  !alt textI'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
Advertisements
Adding images in itext pdf
Adding images in itext pdf  Hi, How to add image in pdf file using itext? Thanks   Hi, You can use following code: PdfWriter.getInstance(document,new FileOutputStream("imagesPDF.pdf")); Read more at Inserting
Collision Detection between two images in Java
Collision Detection between two images in Java  Collision Detection between two images in Java
java collision detection between two images
java collision detection between two images  java collision detection between two images
combining 5 images and text in between to one single image in java
combining 5 images and text in between to one single image in java  Hi I have to combine 5 images and text in between to one single image. I have image followed by description about the image. I have to put them together
solutions for memory leak of dicom images when using ImageIO library.
solutions for memory leak of dicom images when using ImageIO library.   I am utilizing ImageIO.write(). Out of memory error. please don't recommend System.gc(); for optimizing the memory usage
how to create directed line between two buttons when i clicked there
how to create directed line between two buttons when i clicked there  Hi I have to create a topology between 6 nodes. 6 nodes are created as 6 buttons and when i clicked in first button and then on second button a directed
ModuleNotFoundError: No module named 'keep'
ModuleNotFoundError: No module named 'keep'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'keep' How to remove the ModuleNotFoundError: No module named 'keep' error
Images in java
Images in java  how to handle images in java
adding a dialogue
adding a dialogue  Blockquote Hi can you help with the program below,the program is a loop that prints out a code and a quantity when prompt for the user input.what I need is to modify the code to incorporate a dialogue asking
ModuleNotFoundError: No module named 'keep-passwords'
ModuleNotFoundError: No module named 'keep-passwords'  Hi, My... named 'keep-passwords' How to remove the ModuleNotFoundError: No module named 'keep-passwords' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'keep-running'
ModuleNotFoundError: No module named 'keep-running'  Hi, My Python... 'keep-running' How to remove the ModuleNotFoundError: No module named 'keep-running' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'notes-to-keep'
ModuleNotFoundError: No module named 'notes-to-keep'  Hi, My... 'notes-to-keep' How to remove the ModuleNotFoundError: No module named 'notes-to-keep' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'keep-password'
ModuleNotFoundError: No module named 'keep-password'  Hi, My... 'keep-password' How to remove the ModuleNotFoundError: No module named 'keep-password' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'keep-sabbath'
ModuleNotFoundError: No module named 'keep-sabbath'  Hi, My Python... 'keep-sabbath' How to remove the ModuleNotFoundError: No module named 'keep-sabbath' error? Thanks   Hi, In your python
adding loop
adding loop  Hi I have a program that is not compiling when I add a loop can you help me?The program below is compiling without the loop. > Blockquote mport java.util.*; import java.text.*; import java.util.Scanner
Adding an employee
Adding an employee  coding for adding an employee
date between
of my fields is date_, and the type of the field is DateTime. When I want to select records between 2 dates, I use this query: Select * from table1 Where date_ between #01/01/2010# and #31/12/2010# But it shows me the dates
Moving The Images
Moving The Images  How to moving multiple images in one frame using swings
images upload
images upload  I use netbeans IDE 6.8 How i upload any image from any folder to web page
mysql between dates not between dates
mysql between dates not between dates  I am trying to list the data between dates and not between dates using join method ..but that not working for me
jsp images
jsp images  hi I had done a demo application using jsp. And i tried to display some images which is located in the server folder. It has done by using the IP address path of that image folder.. It has been success full in IE
images
background images in css not working
of adding background images in css...background images in css not working  In the application i'm passing a background image from CSS in the given format ... background-image: url
ModuleNotFoundError: No module named 'keep_iam_creds_fresh'
ModuleNotFoundError: No module named 'keep_iam_creds_fresh'  Hi...: No module named 'keep_iam_creds_fresh' How to remove the ModuleNotFoundError: No module named 'keep_iam_creds_fresh' error? Thanks   Hi
jtable-adding a row dynamically
jtable-adding a row dynamically  hi..i am doing a project for pharmacy .. *pblm:* when i want to enter the details in jtable while running the application there are 3 rows and 4 columns which is default bt when we we have
regarding images in jsp
regarding images in jsp  Hi, When I am trying to display an image in jsp, i am getting the image of bar charts in webroots/jspchart/web/jspbarchart.jsp.. But actually I am not getting any image in the browser.. Can any one help
ModuleNotFoundError: No module named 'images'
ModuleNotFoundError: No module named 'images'  Hi, My Python... 'images' How to remove the ModuleNotFoundError: No module named 'images'... to install padas library. You can install images python with following command
problem Scrolling jTable in scrollpane
problem Scrolling jTable in scrollpane

Ads