channeleditor.java.svn-base

来自「通讯采集软件」· SVN-BASE 代码 · 共 52 行

SVN-BASE
52
字号
package collector.gui.guiVo;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class ChannelEditor
    extends DefaultCellEditor {

  public channel_obj m_channel_obj = null;

  public ChannelEditor(JButton b) {
    super(new JCheckBox()); //Unfortunately, the constructor
    editorComponent = b;
    setClickCountToStart(1); //This is usually 1 or 2.

    b.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        fireEditingStopped();
      }
    });
  }

  protected void fireEditingStopped() {
    super.fireEditingStopped();
  }

  public Object getCellEditorValue() {
    if (m_channel_obj == null) {
      return null;
    }
    else {
      return m_channel_obj;
    }
  }

  public Component getTableCellEditorComponent(JTable table,
                                               Object value,
                                               boolean isSelected,
                                               int row,
                                               int column) {
    if (value == null) {
      ( (JButton) editorComponent).setText("");
    }
    else {
      ( (JButton) editorComponent).setText( ( (channel_obj) value).toString());
    }
    m_channel_obj = (channel_obj) value;
    return editorComponent;
  }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?