ifndef Android
sbool setText_opt = true; // optimize by calling getText first
static A setText(A c, O text) {
setText((JComponent) c, text);
ret c;
}
static A setText(final A c, O text) {
// only for editable combo boxes at this point
fS s = strUnnull(text);
swing {
c.getEditor().setItem(s);
}
ret c;
}
svoid setText(JLabel c, O text) {
setText((JComponent) c, text);
}
static JButton setText(JButton c, O text) {
setText((JComponent) c, jlabel_textAsHTML_center_ifNeeded(strUnnull(text)));
ret c;
}
static A setText(final A c, O text) {
if (c == null) null;
final S s = strUnnull(text);
swing {
if (!setText_opt || neq(callOpt(c, "getText"), s))
call(c, "setText", s);
}
ret c;
}
endifndef
ifdef Android
svoid setText() {} // dummy
endifdef