⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 radiobuttoncelleditor.java

📁 一个类似QQ的在线通讯聊天软件原码,适合初学者参考学习。
💻 JAVA
字号:
package openicq.gui;import java.awt.Component;import java.awt.event.ItemEvent;import java.awt.event.ItemListener;import javax.swing.*;/** * The <code>RadioButtonCellEditor</code> class is a custom custom cell editor * for radio buttons. * @author Hansgeorg Schwibbe * @copyright 2004 */class RadioButtonCellEditor extends DefaultCellEditor implements ItemListener{  private JRadioButton radioButton;  /**   * Initializes a new instance of the class <code>RadioButtonCellEditor</code>.   * @param checkBox the check box   */  public RadioButtonCellEditor(JCheckBox checkBox)  {    super(checkBox);  }  /**   * (non-Javadoc)   * @see javax.swing.DefaultCellEditor#getTableCellEditorComponent(javax.swing.JTable,   *      java.lang.Object, boolean, int, int)   */  public Component getTableCellEditorComponent(JTable table, Object value,                                               boolean isSelected, int row,                                               int column)  {    if (value instanceof JRadioButton)    {      radioButton = (JRadioButton) value;      radioButton.addItemListener(this);      return radioButton;    }    return new JLabel(String.valueOf(value));  }  /**   * (non-Javadoc)   * @see javax.swing.DefaultCellEditor#getCellEditorValue()   */  public Object getCellEditorValue()  {    radioButton.removeItemListener(this);    return radioButton;  }  /**   * (non-Javadoc)   * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)   */  public void itemStateChanged(ItemEvent e)  {    super.fireEditingStopped();  }}

⌨️ 快捷键说明

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