public void setValueIn(final Component comp) { // SwingUtilities.invokeAndWait(new Runnable() { // public void run() { JToggleButton fl = (JToggleButton) comp; if (log.isLoggable(Level.INFO)) { log.info("pref:" + pref + ", def=" + def + ", val=" + pr.getBoolean(pref, def)); } fl.setSelected(pr.getBoolean(pref, def)); // } // }); }
public BooleanToggleButtonManager(Preferences prNode, String prefName, boolean def) { // Chop of classname and last package component for logger. String p = getClass().getName(); int idx = p.lastIndexOf('.'); p = p.substring(0, idx); idx = p.lastIndexOf('.'); p = p.substring(0, idx); log = Logger.getLogger(p + "." + prefName.replace('/', '.')); this.def = def; pr = prNode; pref = prefName; }