/**
   * Handle action events coming from the buttons.
   *
   * @param evt, the associated ActionEvent.
   */
  public void actionPerformed(ActionEvent evt) {
    Object source = evt.getSource();

    if (source instanceof JButton) {
      if (source == pbSave) {
        chosen = tcc.getColor();
        onCancel();
      } else {
        onCancel();
      }
    }
  }
Ejemplo n.º 2
0
 /**
  * <br>
  * 方法说明:事件监听。用户选择颜色触发 <br>
  * 输入参数:ChangeEvent e 用户选择事件 <br>
  * 返回类型:
  */
 public void stateChanged(ChangeEvent e) {
   Color newColor = tcc.getColor(); // 获取用户选择的颜色
   banner.setForeground(newColor);
 }