Friday, May 21, 2010

In java, what is a simple way to display array contents with gui?

I am translating a command based program to a GUI I am building. Does anyone know of a simple JPanel style component I can sent toString() -type methods to and have them pop up in a separate GUI frame?

In java, what is a simple way to display array contents with gui?
modify this code, i assume the array is of String data type:


public static void display(String arr){


String display="";


for(int ctr=0; ctr%26lt;arr.length; ctr++){


display+=arr[ctr]+"\n";


}


JOptionPane.showMessageDialog(null, display);


}


check out the JOptionPane class for basic gui in java. it provides good static methods for interfaces.

flower seeds

No comments:

Post a Comment