Skip to main content

hello all for whom a simple list to path conversion...

1 reply [Last post]
omer_jfm
Offline
Joined: 2011-11-15
Points: 0

Hello All;


File[] files = fd.getSelectedFiles();

StringBuilder sb = new StringBuilder();

for (int i = 0; i < files.length; i++)

{

sb.append(files[i].getPath() + "\n");

list.add(sb.toString());

}



This just gets the file and their paths to a list.



I am trying to extract items from this list with;



String Path = list.getItem(0);



But unfortunately i can not convert the string to a filepath...



which i am going to use in;



RenderedImage image = (RenderedImage)JAI.create("fileload",ImPath);



Is there a way?



i looked at some conversions even with stream one but unfortunately it does not allow as a path...


"C:\Users\Public\Pictures\Sample Pictures\1296.jpg"

this is the output from;



String Path = list.getItem(0);



printed to the console as;



System.out.println(Path);



String builder is what i used to divide the selection of files with the multi selection. and write them in the list separated from each other. Hope i am using it correctly.



Thanks for a lot of responses.

Kind Regards

ömer kaya

METU

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
teleporter
Offline
Joined: 2012-05-14
Points: 0

you're codes are a bit messy can't understand what you want to achieve.