jkteater
asked on
Changing a value in my Arraylist
now I have a dialog box getting the users comment. I need to figure out how change the value in my arraylist.
I am thinking it would be something like
public void commentSelectedRow(int row, String comment) {
boolean b = (rds.set) != null);
}
I know that set is looking for what value you want to change and the new value
rds.set(value, comment);
row is the index in the arraylist I want to add the value to
I need to know how to change the value in the last spot - example
row would be equal to tcRevision, tcSelected, tcComment
how do I only change tcComment??
rds.set(row.getTcComment() , comment); ??
I am thinking it would be something like
public void commentSelectedRow(int row, String comment) {
boolean b = (rds.set) != null);
}
I know that set is looking for what value you want to change and the new value
rds.set(value, comment);
row is the index in the arraylist I want to add the value to
I need to know how to change the value in the last spot - example
row would be equal to tcRevision, tcSelected, tcComment
how do I only change tcComment??
rds.set(row.getTcComment()
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You need to update the value at its *source* (which is in the RevDataset instance)
ASKER
The popup dialog is in class 3 do I need to make a instance of class 3 in the RevDataset class, so I can get the comment value? I am trying to figure out how to update the value
ASKER
Can you please step me though how you think the value should be getting updated. I am have tried many things and I am only getting more confused as I go. Heck I am not even sure I can change the value any more.
This is what I tried last
I have a method in RevDataset called
I call that function when creating the table atValue
case COMMENT_COL: { o = rds.get(row).getRevComment (); break; }
so I thought if I get the comment value and somehow assign it where rComment is equal to the user comment then call a firetable, it would show the updated value. But that does not work, for one reason it wants to add the value to all the selections and not just the one.
I will increase the points, I really need help with this one.
This is what I tried last
I have a method in RevDataset called
public String getRevComment() {
return rComment;
}// end RevComment()
I call that function when creating the table atValue
case COMMENT_COL: { o = rds.get(row).getRevComment
so I thought if I get the comment value and somehow assign it where rComment is equal to the user comment then call a firetable, it would show the updated value. But that does not work, for one reason it wants to add the value to all the selections and not just the one.
I will increase the points, I really need help with this one.
btw, i think you might like to consider taking a step back to go forward better. Instead of just adding a String comment member to RevDataset, it would be stronger and more reusable to add a Map instead. That way, you could add any number of extra bits of data to RevDataset at any time and have them reflected in your table. What do you think?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Please, remind, what are the objects which make up elements in your ArrayList ?
Perhaps, post the class to which the elements of your ArrayList belong.
Perhaps, post the class to which the elements of your ArrayList belong.
ASKER
I did get this working over the weekend. I basically was able to find the field by using the selected row index and assigning the user comment to the null value.
I will split the points and I do appreciate your time and effort in helping me.
I will split the points and I do appreciate your time and effort in helping me.
>>I will split the points and I do appreciate your time and effort in helping me.
I don't understand why that's the 'accepted solution' but thanks anyway
I don't understand why that's the 'accepted solution' but thanks anyway
ASKER
In my table, which is a display of what the user selects and adds to the ArrayList. Well now at the end of the table there is column named comments and by default it is a null field. I have added a button to the dialog that will take the selected row in the table and pop up a dialog
Open in new window
I am basically wanting to get the value of the comment the user typed in and the row (index of the arraylist )
I want to update the null comment with the value to the user typed in. So in the commentSelectedRow(row, comment); method I am trying to pass in the row (index) and the comment. Then in the Arraylist change the vlaue from NULL to what the user typed in then update the table to show the comment.