Hi!
I'd like to update all of the JComponents in a JFrame. Since JFrame (java 1.5) doesn't take the updateUI() method, how do it do it without hard coding each item?
I've tried Frame.getComponents(), then cast back to JComponents, but it did absolutely nothing.
I've also notice many Java applications require a restart after L&F has changed, which seems unnecessary.
/* This is really ugly, but couldn't find a better method */
private void updateUI() {
JComponent all[] = {oneList,
onePanel,
twoPanel,
oneScroll,
oneScroll.getHorizontalScrollBar(),
oneScroll.getVerticalScrollBar(),
twoScroll,
twoScroll.getHorizontalScrollBar(),
twoScroll.getVerticalScrollBar(),
oneTree};
for (JComponent j : all) {
j.updateUI();
}
for (JComponent j : oneButtons) {
j.updateUI();
}
}
-Tres / FBL