Esempio n. 1
0
  /**
   * This method gets called when a bound property is changed on the associated JTextComponent. This
   * is a hook which UI implementations may change to reflect how the UI displays bound properties
   * of JTextComponent subclasses. If the font, foreground or document has changed, the the
   * appropriate property is set in the default style of the document.
   *
   * @param evt the property change event
   */
  @Override
  protected void propertyChange(PropertyChangeEvent evt) {
    super.propertyChange(evt);

    String name = evt.getPropertyName();

    if (name.equals("foreground")) {
      updateForeground((Color) evt.getNewValue());
    } else if (name.equals("font")) {
      updateFont((Font) evt.getNewValue());
    } else if (name.equals("document")) {
      JComponent comp = getComponent();
      updateForeground(comp.getForeground());
      updateFont(comp.getFont());
    }
  }