This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Hi, Paveen - Welcome to JavaRanch. I'm pretty sure you won't see a question like this on the SCJP certification exam, especially the 1.4 exam. Are you asking for a particular project? Maybe this question belongs in another forum. Also, could you provide the context? Sometimes the answer may be different depending on the context. Thanks.
Give a man a fish, he'll eat for one day. <br />Teach a man to fish, he'll drink all your beer.<br /> <br />Cheers,<br /> <br />Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
Joined: Oct 21, 2003
Iam new here so maybe I put it in the wrong Place. Maybe,this doesnt belong here.But appreciate ur help......
Here's the context: Iam trying to read n inputs using jlabels and jtext fields. n is user defined. Then I want to generate n JLabels and n Jtext fields using a loop. I want to add All of them onto one content pane.
:All this effort is to read an input into a n x 3 matrix. Thanks in advance.
Joined: Jul 30, 2003
I've never used an array of JLabels, but I have had to change the text of existing JLabels. For this, use the method setText(String t). (Have you tried this? How are you trying to set the text?) The way to use the JLabel methods is:
Then add this to your content frame. I see no reason why this couldn't be extended to an array of JLabels updated from an array of Strings. One warning though: if you try to initialize the JLabel from the user's input, the compiler will complain. Hope this helps. If not, please post the code for the loop you're using, and I'll see if I can find the problem. Please be sure to use the UBB tags for code. [ October 21, 2003: Message edited by: Jeff Bosch ]