📄 radiobuttontablecellrenderer.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 + -