コード例 #1
0
  /**
   * 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();
      }
    }
  }
コード例 #2
0
 /**
  * <br>
  * 方法说明:事件监听。用户选择颜色触发 <br>
  * 输入参数:ChangeEvent e 用户选择事件 <br>
  * 返回类型:
  */
 public void stateChanged(ChangeEvent e) {
   Color newColor = tcc.getColor(); // 获取用户选择的颜色
   banner.setForeground(newColor);
 }
コード例 #3
0
ファイル: ColorChooser.java プロジェクト: okohll/svg_editor
 public void actionPerformed(ActionEvent e) {
   color = chooser.getColor();
 }
コード例 #4
0
ファイル: ColorButton.java プロジェクト: cuulee/PyramidShader
 /** Action listener for the OK button in the color chooser. */
 public void actionPerformed(ActionEvent e) {
   // ok button in color chooser was pressed.
   this.setColor(colorChooser.getColor());
   super.fireActionPerformed(e);
 }