> hi Duane,
>
> I think you didnt' get what I wanted to ask ( maybe I was not clear)
The "maybe I was not clear" is a good start....
> (JComboBox)e.getSource()).getSelectedItem() returns new selected
> value in combo box
[quoted text clipped - 4 lines]
>
> Please read my code again.
...but thats no a really good continuation. Do you think the question
is much clearer now?
Anyways, you have shown us a big "if" block where lots of things are
happening. If I understand your scenario correctly, you have two
arrays: one called "val" which is an array of string arrays that you
use to populate a JComboBox, and the other one is called "usr_val" that
holds strings and is used to set the JComboBox default values. You want
to change the default value when the selected item in the corresponding
JComboBox has changed. To manage your arrays and JComboBoxes, you have
one counter "i" which seems to count the arrays of string arrays and
the array with the default strings and one counter "_combobox_count"
which counts the JComboBoxes that have been genererated with the help
of these arrays. Obviously, the arrays could be used to generate a
different JComponent as well, in which case "i" and "_combobox_count"
will have different values.
Both "i" and "_combobox_count" are clearly available within the
if-block, so you don´t need any extra tricks to access them. What
happens if you directly access "i" or "_combobox_count" from within the
"itemStateChanged"-method?
HTH, PIet
vikas talwar - 28 May 2006 09:58 GMT
Hello Piet,
you hava understood my code( ur perfectly clear).
but value of 'i' and '_combobox_counter' is always chaning while
generating GUI interface.
and at the time of event genreration the value of 'i' will be last
element of JComponentArray, and '_combobox_counter' will be last
element comboBoxArray.
vikas talwar - 28 May 2006 10:00 GMT
.Hello Piet,
you understood my code well (gr8).
but value of 'i' and '_combobox_counter' is always chaning while
generating GUI interface.
and at the time of event genreration the value of 'i' will be last
element of JComponentArray, and '_combobox_counter' will be last
element comboBoxArray
> hi Duane,
>
[quoted text clipped - 8 lines]
>
> Please read my code again.
Oh, you just want to refer to variable in the outer class from within the
inner class, right?
Declare these variables as class variables, then they will be visible to
inner classes. You can refer to them inside the inner class as just "i"
and "_combobox_count".