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

📄 radiobuttontablecellrenderer.java

📁 一个类似QQ的在线通讯聊天软件原码,适合初学者参考学习。
💻 JAVA
字号:
package openicq.gui;import java.awt.Component;import javax.swing.*;import javax.swing.table.TableCellRenderer;/** * The <code>RadioButtonTableCellRenderer</code> class is a custom table cell * renderer for radio buttons in tables. * @author Hansgeorg Schwibbe * @copyright 2004 */public class RadioButtonTableCellRenderer implements TableCellRenderer{  private JRadioButton radioButton;  /**   * (non-Javadoc)   * @see javax.swing.table.TableCellRenderer#getTableCellRendererComponent(javax.swing.JTable,   *      java.lang.Object, boolean, boolean, int, int)   */  public Component getTableCellRendererComponent(JTable table, Object value,                                                 boolean isSelected,                                                 boolean hasFocus, int row,                                                 int column)  {    if (value instanceof JRadioButton)    {      radioButton = (JRadioButton) value;      radioButton.setBackground(table.getBackground());      radioButton.setForeground(table.getForeground());      radioButton.setFont(table.getFont());      radioButton.setEnabled(table.isEnabled());      radioButton.setOpaque(table.isOpaque());      radioButton.setHorizontalAlignment((int) Component.CENTER_ALIGNMENT);      return radioButton;    }    return new JLabel(String.valueOf(value));  }}

⌨️ 快捷键说明

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