本文整理了Java中javax.swing.JTable.getBackground()
方法的一些代码示例,展示了JTable.getBackground()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTable.getBackground()
方法的具体详情如下:
包路径:javax.swing.JTable
类名称:JTable
方法名:getBackground
暂无
代码示例来源:origin: skylot/jadx
private void updateSelection(JTable table, Component comp, boolean isSelected) {
if (comp instanceof RSyntaxTextArea) {
if (isSelected) {
comp.setBackground(codeSelectedColor);
} else {
comp.setBackground(codeBackground);
}
} else {
if (isSelected) {
comp.setBackground(table.getSelectionBackground());
comp.setForeground(table.getSelectionForeground());
} else {
comp.setBackground(table.getBackground());
comp.setForeground(table.getForeground());
}
}
}
代码示例来源:origin: pedrovgs/AndroidWiFiADB
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus,
int row, int column) {
if (isSelected) {
connectDisconnectPane.setBackground(table.getSelectionBackground());
} else {
connectDisconnectPane.setBackground(table.getBackground());
}
return connectDisconnectPane;
}
}
代码示例来源:origin: checkstyle/checkstyle
/**
* TreeCellRenderer method. Overridden to update the visible row.
* @see TableCellRenderer
*/
@Override
public Component getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row, int column) {
if (isSelected) {
setBackground(table.getSelectionBackground());
}
else {
setBackground(table.getBackground());
}
visibleRow = row;
return this;
}
代码示例来源:origin: stackoverflow.com
table.setDefaultRenderer(Object.class, new DefaultTableCellRenderer(){
@Override
public Component getTableCellRendererComponent(JTable table,
Object value, boolean isSelected, boolean hasFocus, int row, int col) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
String status = (String)table.getModel().getValueAt(row, STATUS_COL);
if ("active".equals(status)) {
setBackground(Color.BLACK);
setForeground(Color.WHITE);
} else {
setBackground(table.getBackground());
setForeground(table.getForeground());
}
return this;
}
});
代码示例来源:origin: stackoverflow.com
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
{
setText((String)value);
setSize(table.getColumnModel().getColumn(column).getWidth(),getPreferredSize().height);
setSelectionColor(Color.GREEN);
if (isSelected)
{
setBackground(table.getSelectionBackground());
setForeground(table.getSelectionForeground());
}
else
{
setBackground(table.getBackground());
setForeground(table.getForeground());
}
return this;
}
代码示例来源:origin: stackoverflow.com
private class StatusRenderer implements TableCellRenderer {
private static final long serialVersionUID = 1L;
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (isSelected) {
setBackground(table.getSelectionBackground());
} else {
setBackground(table.getBackground());
}
return this;
}
}
代码示例来源:origin: stackoverflow.com
@Override
public Component getTableCellRendererComponent(
JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
{
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
// add custom rendering code
if (isSelected)
setBackground( table.getSelectionBackground() );
else
setBackground( table.getBackground() );
return this;
}
代码示例来源:origin: senbox-org/snap-desktop
private void setBackground(final JTable table, final boolean isSelected) {
if (tableComponent == null) return;
Color backGroundColor = table.getBackground();
if (isSelected) {
backGroundColor = table.getSelectionBackground();
}
tableComponent.setBorder(BorderFactory.createLineBorder(backGroundColor, 3));
tableComponent.setBackground(backGroundColor);
}
代码示例来源:origin: bcdev/beam
private void setBackground(final JTable table, final boolean isSelected) {
Color backGroundColor = table.getBackground();
if (isSelected) {
backGroundColor = table.getSelectionBackground();
}
tableComponent.setBorder(BorderFactory.createLineBorder(backGroundColor, 3));
tableComponent.setBackground(backGroundColor);
}
代码示例来源:origin: SonarSource/sonarlint-intellij
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean selected, boolean focus, int row, int column) {
Component component = super.getTableCellRendererComponent(table, value, false, focus, row, column);
Color bg = selected ? table.getSelectionBackground() : table.getBackground();
component.setBackground(bg);
((JLabel) component).setText("");
return component;
}
代码示例来源:origin: protegeproject/swrlapi
@Override public void initialize()
{
JTable inferredAxiomsTable = new JTable(this.inferredAxiomsTableModel);
JScrollPane scrollPane = new JScrollPane(inferredAxiomsTable);
JViewport viewPort = scrollPane.getViewport();
setLayout(new BorderLayout());
viewPort.setBackground(inferredAxiomsTable.getBackground());
add(BorderLayout.CENTER, scrollPane);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project
private void initTableVisualProperties() {
frameworksTable.getModel().addTableModelListener(this);
frameworksTable.getSelectionModel().addListSelectionListener(this);
frameworksTable.setRowHeight(frameworksTable.getRowHeight() + 4);
frameworksTable.setIntercellSpacing(new Dimension(0, 0));
// set the color of the table's JViewport
frameworksTable.getParent().setBackground(frameworksTable.getBackground());
frameworksTable.getColumnModel().getColumn(0).setMaxWidth(30);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-spring-beans
/** Creates new form SpringXMLConfigGroupVisual */
public SpringXMLConfigGroupVisual(List<ConfigFileGroup> configFileGroups) {
initComponents();
groupsTable.getParent().setBackground(groupsTable.getBackground());
groupsTable.setModel(new ConfigGroupSelectionTableModel(configFileGroups));
groupsTable.getColumnModel().getColumn(0).setMaxWidth(0);
groupsTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-spring-beans
public SpringXMLConfigNamespacesVisual() {
initComponents();
// set the color of the table's JViewport
includesTable.getParent().setBackground(includesTable.getBackground());
TableColumn col1 = includesTable.getColumnModel().getColumn(0);
col1.setMaxWidth(0);
includesTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
includesTable.revalidate();
// springLibrary = SpringUtilities.findSpringLibrary();
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int rowIndex, int column) {
check.setSelected(table.isRowSelected(rowIndex));
setBackground(isSelected ? table.getSelectionBackground() : table.getBackground());
if (hasFocus) {
setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
} else {
setBorder(null);
}
return this;
}
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int rowIndex, int column) {
radio.setSelected(table.isRowSelected(rowIndex));
setBackground(isSelected ? table.getSelectionBackground() : table.getBackground());
if (hasFocus) {
setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
} else {
setBorder(null);
}
return this;
}
代码示例来源:origin: protegeproject/protege
@Override
protected void fillPage(Page page, JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Color foreground = isSelected ? table.getSelectionForeground() : table.getForeground();
Color background = isSelected ? table.getSelectionBackground() : table.getBackground();
renderCellValue(page, value, foreground, background, isSelected);
}
代码示例来源:origin: edu.stanford.protege/protege-editor-owl
@Override
protected void fillPage(Page page, JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Color foreground = isSelected ? table.getSelectionForeground() : table.getForeground();
Color background = isSelected ? table.getSelectionBackground() : table.getBackground();
renderCellValue(page, value, foreground, background, isSelected);
}
代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl
@Override
protected void fillPage(Page page, JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Color foreground = isSelected ? table.getSelectionForeground() : table.getForeground();
Color background = isSelected ? table.getSelectionBackground() : table.getBackground();
renderCellValue(page, value, foreground, background, isSelected);
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_http
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column) {
setText((String) value);
setBackground(isSelected && !hasFocus ? table.getSelectionBackground() : table.getBackground());
setForeground(isSelected && !hasFocus ? table.getSelectionForeground() : table.getForeground());
setFont(table.getFont());
return this;
}
}
内容来源于网络,如有侵权,请联系作者删除!