aspose file tools*
The moose likes Beginning Java and the fly likes String Array to JLabel Array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "String Array to JLabel Array" Watch "String Array to JLabel Array" New topic
Author

String Array to JLabel Array

Jesse Walker
Ranch Hand

Joined: Aug 18, 2004
Posts: 50
I am attempting to take a String Array that was passed from another Class and insert the text into a JLabel Array to display on a JFrame. The length of the String Array will be different each time. I have used the following code in my attempts:
1)
JLabel[] labels;//gives me a variable may not have been intialized
2)
int y = Array.getLength(info)// where info is the name of the StringArray, JLabel[y] label; //it give me a cannot recognize complier error
3)
JLabel[] labels = {};
and
JLabel[] labels = {new JLabel(info[0])};
When I use the code above and use a loop to try to add the rest of the variables from the STring array to this array I get an ArrayOutOFIndexException.
Any help would be appreciated at all
Thank you,
Jesse
Ajay Singh
Ranch Hand

Joined: Dec 13, 2006
Posts: 182
try these corrections (i assume that info is the string array)
1.

2.


3.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String Array to JLabel Array
 
Similar Threads
Adding a click method to all jlabels
Accessing a jLabel with % reference?
label text auto update
Mouse shift event coding - to trigger a predetermined sequence of images to a GUI
Change jLabel properties in loop