P Veer

+ Follow
since Oct 21, 2003
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by P Veer

OOps!! Sorry!! I put it in the wrong Place.Can Anyone Help me out with this problem???

Thanks in advance!!
18 years ago
Iam trying to read a file like this from a text area:
P1 7 5 3
P2 3 2 2
P3 9 0 2
P4 2 2 2
P5 4 3 3
P5 2 1 0
P3 1 0 1
P1 2 0 0
P4 2 1 1
P2 1 0 2
P5 0 0 3
P2 0 2 0
P5 1 0 0
P3 2 0 0
P4 0 1 0
How do I do this??I tried using Labels and textfileds for each different line but couldn't do it.I have no idea how do read this from a text area and seprate them into Different pieces.Tried to understand TextListener but could not figure out.Can anyone help me with the code??
Thanks in Advance!!!
18 years ago
Thanks a lot!!! It Works
Iam working on a program that uses many arrays like that.And ive been creating the whole array inside.Using the new keyword inside the constructor was the problem I wasnt able to detect.
I really appreciate it and Thanks once again!!!
18 years ago
Iam creating an array in a class which has no main method like this:
int[][] Allocation = new int[n][3];
Then Iam trying to initialise all the elements to 1 in the constructor:
n is passed in through the constructor(parameter)
for (int row=0; row <= n-1; row++) {
for (int col=0; col <=2; col++) {
Allocation[row][col] = 1; } }
It gives me an error:
java.lang.ArrayIndexOutOfBoundsException: 0

Please Help me out!!!
18 years ago
Thanks.I think that solves the problem.
18 years ago
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.
18 years ago
It is not required to have those methods since they are only used to access private data members.If you want to restrict the access to private data members within the class there is no need for creating accesors and mutators.
Yes.I think so.Accessor and mutator methods are only used to get access of these private data members outside the class.If they too are declared private or protected it doesn't make sense to write these additional methods.
How to create an array of JLabels and then initialise "n" JLabels to different values in a loop.
18 years ago