I try to send a file list from PHP to my Java program. I thought JSON was a good idea so I ended up with this JSON Array:
{"0":"File1.png","1":"File2.png","2":"File3.html"}
Now I want Java to show the files on a showMessageDialog
like this:
Your Files:
File1.png
File2.png
File3.html
Can anyone help me with this?
What I have:
String fileurl = "http://my.website/the/json/file/list";
String jsonStr = getHTML(fileurl); //getHTML => Gets the JSON Code
System.out.println(jsonStr); //Just for testing reasons
//JSON Array to Java Array here?
JTextArea ausgabeBereich = new JTextArea(10, 10); //Creating a JTextArea
JScrollPane scroller = new JScrollPane(ausgabeBereich); //With a ScrollPane
String ausgabe = "Your Files\n";
ausgabe += //Adding the files here?
ausgabeBereich.setText(ausgabe); //Set the text of the TextArea
JOptionPane.showMessageDialog(null,scroller,"Dateien",
JOptionPane.PLAIN_MESSAGE); // Shows the Windows