com.scudata.ide.common.swing.CheckBoxRenderer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of esproc Show documentation
Show all versions of esproc Show documentation
SPL(Structured Process Language) A programming language specially for structured data computing.
package com.scudata.ide.common.swing;
import java.awt.Component;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;
import com.scudata.ide.common.GM;
/**
* JTable??Ԫ??ѡ????Ⱦ??
*
*/
public class CheckBoxRenderer extends JCheckBox implements TableCellRenderer {
private static final long serialVersionUID = 1L;
/**
* ???캯??
*/
public CheckBoxRenderer() {
setHorizontalAlignment(JLabel.CENTER);
}
/**
* ???ر༭?ؼ?
*/
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
if (isSelected) {
setForeground(table.getSelectionForeground());
setBackground(table.getSelectionBackground());
} else {
setForeground(table.getForeground());
setBackground(table.getBackground());
}
if (value == null || !(value instanceof Boolean)) {
value = new Boolean(false);
}
try {
setSelected(((Boolean) value).booleanValue());
} catch (Exception e) {
GM.showException(e);
}
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy