本文整理了Java中javax.swing.JTable.setSelectionBackground()
方法的一些代码示例,展示了JTable.setSelectionBackground()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTable.setSelectionBackground()
方法的具体详情如下:
包路径:javax.swing.JTable
类名称:JTable
方法名:setSelectionBackground
暂无
代码示例来源:origin: marytts/marytts
table.setSelectionBackground(new java.awt.Color(153, 204, 255));
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_http
private void enableTable(boolean custEnabled, boolean sysEnabled, JTable table, PowerTableModel model,
JButton addButton, JButton deleteButton) {
table.setEnabled(custEnabled);
Color greyColor = new Color(240, 240, 240);
Color blueColor = new Color(184, 207, 229);
table.setBackground(sysEnabled ? greyColor : Color.WHITE);
table.setSelectionBackground(sysEnabled ? greyColor : blueColor);
addButton.setEnabled(custEnabled);
deleteButton.setEnabled(custEnabled);
if (custEnabled && (model.getRowCount() > 0)) {
deleteButton.setEnabled(true);
addButton.setEnabled(true);
}
}
代码示例来源:origin: tulskiy/musique
@Override
public void setSelectionBackground(Color selectionBackground) {
super.setSelectionBackground(selectionBackground);
if (selectionBackground != null) {
setSelectionForeground(Util.getContrastColor(selectionBackground));
selectBgColor1 = new Color(selectionBackground.getRGB());
selectBgColor2 = darker(selectionBackground);
}
}
代码示例来源:origin: stackoverflow.com
public void init() {
//...
//Jtable attribute and location
JTable table = new JTable();
table.setModel(new javax.swing.table.DefaultTableModel(
new Object[][]{
{null, null, null, null, null},
{null, null, null, null, null},
{null, null, null, null, null},
{null, null, null, null, null},
{null, null, null, null, null},
{null, null, null, null, null},
{null, null, null, null, null},
{null, null, null, null, null},
{null, null, null, null, null}
},
new String[]{
"name", "TypeDebt", " amount ", "DateDebt", "Due_Date"
}
));
table.setPreferredScrollableViewportSize(new Dimension(300, 400));
table.setSelectionBackground(getBackground());
JScrollPane scrollpane = new JScrollPane(table);
scrollpane.setBounds(200, 60, 490, 490);
background.add(scrollpane);
代码示例来源:origin: org.netbeans.api/org-openide-explorer
/** Allows to subclasses initialize table
* @param t
*/
private void initializeTable() {
table.setModel(tableModel);
tableCell = new TableSheetCell(tableModel);
table.setDefaultRenderer(Node.Property.class, tableCell);
table.setDefaultEditor(Node.Property.class, tableCell);
table.getTableHeader().setDefaultRenderer(tableCell);
table.setShowGrid(false);
table.setIntercellSpacing(new Dimension(0, 0));
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.getTableHeader().setReorderingAllowed(false);
if (UIManager.getColor("Panel.background") != null) { // NOI18N
table.setBackground(UIManager.getColor("Panel.background")); // NOI18N
table.setSelectionBackground(UIManager.getColor("Panel.background")); // NOI18N
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
/** Allows to subclasses initialize table
* @param t
*/
private void initializeTable() {
table.setModel(tableModel);
TableSheetCell tableCell = new TableSheetCell(tableModel);
table.setDefaultRenderer(Node.Property.class, tableCell);
table.setDefaultEditor(Node.Property.class, tableCell);
table.getTableHeader().setDefaultRenderer(tableCell);
table.setShowGrid(false);
table.setIntercellSpacing(new Dimension(0, 0));
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.getTableHeader().setReorderingAllowed(false);
if (UIManager.getColor("Panel.background") != null) { // NOI18N
table.setBackground(UIManager.getColor("Panel.background")); // NOI18N
table.setSelectionBackground(UIManager.getColor("Panel.background")); // NOI18N
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
/** Allows to subclasses initialize table
* @param t
*/
private void initializeTable() {
table.setModel(tableModel);
TableSheetCell tableCell = new TableSheetCell(tableModel);
table.setDefaultRenderer(Node.Property.class, tableCell);
table.setDefaultEditor(Node.Property.class, tableCell);
table.getTableHeader().setDefaultRenderer(tableCell);
table.setShowGrid(false);
table.setIntercellSpacing(new Dimension(0, 0));
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.getTableHeader().setReorderingAllowed(false);
if (UIManager.getColor("Panel.background") != null) { // NOI18N
table.setBackground(UIManager.getColor("Panel.background")); // NOI18N
table.setSelectionBackground(UIManager.getColor("Panel.background")); // NOI18N
}
}
代码示例来源:origin: rememberber/WeSync
tableFrom.setRowHeight(31);
tableFrom.setGridColor(ConstantsUI.TABLE_LINE_COLOR);
tableFrom.setSelectionBackground(ConstantsUI.TOOL_BAR_BACK_COLOR);
代码示例来源:origin: net.sf.cuf/cuf-swing
table.setSelectionBackground(UIManager.getColor("Table.selectionBackground"));
table.setForeground (UIManager.getColor("Table.foreground"));
table.setBackground (UIManager.getColor("Table.background"));
table.setSelectionBackground(UIManager.getColor("ComboBox.disabledBackground"));
table.setForeground (UIManager.getColor("ComboBox.disabledForeground"));
table.setBackground (UIManager.getColor("ComboBox.disabledBackground"));
代码示例来源:origin: org.cytoscape/table-import-impl
primaryKeyComboBox.getSelectedIndex()));
curTable.setEnabled(true);
curTable.setSelectionBackground(Color.white);
curTable.getTableHeader().setReorderingAllowed(false);
代码示例来源:origin: UNIVALI-LITE/Portugol-Studio
jTblErros.setRequestFocusEnabled(false);
jTblErros.setRowHeight(32);
jTblErros.setSelectionBackground(new java.awt.Color(0, 84, 148));
jTblErros.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
jTblErros.setShowHorizontalLines(false);
代码示例来源:origin: stackoverflow.com
table.setSelectionBackground(Color.CYAN);
frame.add(new JScrollPane(table));
frame.pack();
代码示例来源:origin: atarw/material-ui-swing
@Override
public void installUI (JComponent c) {
super.installUI (c);
JTable table = (JTable) c;
table.setOpaque (false);
table.setSelectionForeground (UIManager.getColor ("Table.selectionForeground"));
table.setBackground (UIManager.getColor ("Table.background"));
table.setFont (UIManager.getFont ("Table.font"));
table.setBorder (UIManager.getBorder ("Table.border"));
table.setGridColor (UIManager.getColor ("Table.gridColor"));
table.setSelectionBackground (UIManager.getColor ("Table.selectionBackground"));
table.getTableHeader ().setResizingAllowed (true);
int rowHeight = UIManager.getInt ("Table.rowHeight");
if (rowHeight > 0) {
table.setRowHeight (rowHeight);
}
else {
table.setRowHeight (table.getRowHeight () + 25);
}
table.setDefaultRenderer (Object.class, new MaterialTableCellRenderer ());
table.setDefaultEditor (Object.class, new MaterialTableCellEditor ());
}
代码示例来源:origin: hs-web/hsweb-generator
/**
* 创建表格
*/
protected void createTable() {
final Object[][] cellData = new Object[][]{};
final DefaultTableModel model = new DefaultTableModel(cellData, columnNames);
final DefaultTableCellRenderer render = new DefaultTableCellRenderer();
render.setHorizontalAlignment(SwingConstants.CENTER);
table = new JTable(model) {
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
};
table.setDefaultRenderer(Object.class,render);
table.setSize(SwingGeneratorApplication.WIDTH - 70, 300);
table.setRowMargin(4);
table.setFont(SwingGeneratorApplication.BASIC_FONT_MIN);
table.setRowHeight(25);
table.setSelectionBackground(new Color(227, 227, 227));
for (Object[] objects : defaultData) {
model.addRow(objects);
}
}
代码示例来源:origin: stackoverflow.com
jfrm.setSize(500, 160);
table = new JTable(data, headings);
table.setSelectionBackground(Color.GREEN);
TableColumn ledgerColumn = table.getColumnModel().getColumn(0);
ledgerColumn.setCellEditor(new ComboBoxCellEditor(comboBox));
代码示例来源:origin: UNIVALI-LITE/Portugol-Studio
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents()
{
jScrollPaneTabelaMensagens = new javax.swing.JScrollPane();
tabelaMensagens = new javax.swing.JTable();
setBorder(javax.swing.BorderFactory.createEmptyBorder(8, 8, 8, 8));
setFocusable(false);
setOpaque(false);
setLayout(new java.awt.BorderLayout());
jScrollPaneTabelaMensagens.setBorder(null);
jScrollPaneTabelaMensagens.setFocusable(false);
jScrollPaneTabelaMensagens.setName("scrollMensagensCompilador"); // NOI18N
jScrollPaneTabelaMensagens.setOpaque(false);
tabelaMensagens.setBackground(new java.awt.Color(245, 245, 245));
tabelaMensagens.setToolTipText("");
tabelaMensagens.setFillsViewportHeight(true);
tabelaMensagens.setName("tabelaMensagensCompilador"); // NOI18N
tabelaMensagens.setOpaque(false);
tabelaMensagens.setRequestFocusEnabled(false);
tabelaMensagens.setRowHeight(24);
tabelaMensagens.setSelectionBackground(new java.awt.Color(0, 84, 148));
tabelaMensagens.setShowHorizontalLines(false);
tabelaMensagens.setShowVerticalLines(false);
jScrollPaneTabelaMensagens.setViewportView(tabelaMensagens);
add(jScrollPaneTabelaMensagens, java.awt.BorderLayout.CENTER);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
代码示例来源:origin: stackoverflow.com
table.setSelectionBackground(Color.GREEN);
for (int i : selCols)
c.setBackground(Color.RED);
代码示例来源:origin: omegat-org/omegat
public static void applyColors(JTable table) {
if (!Platform.isMacOSX()) {
// Windows needs some extra colors set for consistency, but these
// ruin native LAF on OS X.
if (table.getParent() instanceof JViewport) {
table.getParent().setBackground(COLOR_STANDARD_BG);
}
if (table.getParent().getParent() instanceof JScrollPane) {
table.getParent().getParent().setBackground(COLOR_STANDARD_BG);
}
if (table.getTableHeader() != null) {
table.getTableHeader().setBackground(COLOR_STANDARD_BG);
}
}
table.setForeground(COLOR_STANDARD_FG);
table.setBackground(COLOR_STANDARD_BG);
table.setSelectionForeground(COLOR_SELECTION_FG);
table.setSelectionBackground(COLOR_SELECTION_BG);
table.setGridColor(COLOR_STANDARD_BG);
}
代码示例来源:origin: net.sf.jt400/jt400
table_.selectAll();
table_.setSelectionMode(0);
table_.setSelectionBackground(Color.gray);
table_.setShowGrid(false);
table_.clearSelection();
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
if(sbg==null || sbg instanceof UIResource)
table.setSelectionBackground(UIManager.getColor("Table.selectionBackground"));
内容来源于网络,如有侵权,请联系作者删除!