Example #1
0
 // Actually set things up.
 private void init() {
   if (Settings.debug) System.err.println("Creating new custom kit");
   updateDelegate();
   panes = new HashSet();
   // Set the font correctly on already-opened windows, so the user
   // can see customizations live. Also make sure that our delegate
   // is kept up-to-date.
   listener =
       new PropertyChangeListener() {
         public void propertyChange(PropertyChangeEvent ev) {
           if (ev.getPropertyName().equals(Settings.PROP_kitClass)) updateDelegate();
           else if (ev.getPropertyName().equals(Settings.PROP_font)) {
             if (panes != null) {
               Iterator it = panes.iterator();
               while (it.hasNext()) {
                 JEditorPane pane = (JEditorPane) it.next();
                 pane.setFont(Settings.font);
                 pane.repaint();
               }
             }
           }
         }
       };
   Settings.DEFAULT.addPropertyChangeListener(listener);
 }
Example #2
0
 protected void finalize() throws Exception {
   if (Settings.debug) System.err.println("Destroying custom kit");
   Settings.DEFAULT.removePropertyChangeListener(listener);
 }