views:

53

answers:

1

I have an wrapping object array -in fact a matrix- which includes a checkbox, I want to detect this object's position in array when included checkbox's state changes

public class visualCell implements ItemSelectable{
    private JCheckBox checkBox;
    private int row;
    private int col;
}

when a checkbox changes it's state, I want to be able to access the visualCell object which includes that, if that is possible. I add the listener to wrapping object by the way.

A: 

You have a number of options. One would be to pass the row and col to the listener, and locate your VisualObject (use upper-case first letter btw) based on those parameters. Your listener implementation will need a reference to your matrix.

Bozho
I missed the upper-case, thank you for the solution, effective use of listeners is the answer then..
mustafabattal