[pkg-j2se-devel] j2re1.4: send ItemEvent without user action
Joan Queralt
jqueral7 at xtec.net
Sun Jan 15 23:05:19 UTC 2006
Subject: j2re1.4: send ItemEvent without user action
Package: j2re1.4
Version: 1.4.2.03-1
Severity: normal
The following code:
Choice _idioma;
(...)
int totalIdiomes=Etiquetes.idiomes.length;
_idioma.removeAll();
for (int i=0;i<totalIdiomes;i++) {
_idioma.add(Etiquetes.idiomes[_numIdioma][i]);
}
generate some ItemEvent's that are sended to the Choice ItemListener's.
This differs from Sun Virtual Machine behaviour and from what the Sun
documentation says: "Class ItemEvent: This high-level event is generated
by an ItemSelectable object (such as a List) when an item is selected or
deselected by the user", because they aren't produced by user action.
The following code will work on Sun JRE but not on Blackdown:
Choice _idioma;
(...)
public void itemStateChanged(ItemEvent arg0) {
_numIdioma=_idioma.getSelectedIndex();
int totalIdiomes=Etiquetes.idiomes.length;
_idioma.removeAll();
for (int i=0;i<totalIdiomes;i++) {
_idioma.add(Etiquetes.idiomes[_numIdioma][i]);
}
}
because it leads to an infinite loop.
Please, contact me if this message isn't clear enough or if you need a
full code example.
Regards,
Joan Queralt
-- System Information:
Debian Release: 3.1
APT prefers testing
APT policy: (500, 'testing')
Architecture: i386 (i686)
More information about the pkg-j2se-devel
mailing list