How to repaint ALL visible components of Java Swing application? -
i have jframe allows user adjust colors. colors set static fields of class colors
using reflection. here colors
class:
public class colors { public static color textbackground = color.black; public static color textforeground = color.white; }
there many other components, located in several jframe's, , use fields of colors
class. when manually cause them repaint (e.g. resizing), repaint correctly.
but how can cause other components repaint automatically?
i tried seems dirty changing lookandfeel, didn't work:
uimanager.setlookandfeel(uimanager.getlookandfeel());
update: need repaint components in other jframe's, visible.
you'll need call method on jframe let know content needs repainted when change colors. believe correct method revalidate()
, repaint()
may work well. more information on painting in swing, try looking here:
Comments
Post a Comment