javax.swing.JTable.setForeground()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(181)

本文整理了Java中javax.swing.JTable.setForeground()方法的一些代码示例,展示了JTable.setForeground()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTable.setForeground()方法的具体详情如下:
包路径:javax.swing.JTable
类名称:JTable
方法名:setForeground

JTable.setForeground介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

private void uiStyle () {
  contentPane.setBackground(new Color(36, 36, 36));
  topPanel.setBackground(new Color(36, 36, 36));
  topPanel.setForeground(new Color(255, 255, 255));
  table.setBackground(new Color(46, 46, 46));
  table.setForeground(new Color(255, 255, 255));
  bottomPanel.setBackground(new Color(36, 36, 36));
  bottomPanel.setForeground(new Color(255, 255, 255));
  buttonPanel.setBackground(new Color(36, 36, 36));
  buttonPanel.setForeground(new Color(255, 255, 255));
  scrollPane.setBorder(BorderFactory.createEmptyBorder());
  scrollPane.setBackground(new Color(36, 36, 36));
  scrollPane.getViewport().setBackground(new Color(36, 36, 36));
  warningNotice.setForeground(new Color(255, 20, 20));
  warningNotice2.setForeground(new Color(255, 20, 20));
}

代码示例来源:origin: magefree/mage

mainTable.setForeground(Color.white);
DefaultTableCellRenderer myRenderer = (DefaultTableCellRenderer) mainTable.getDefaultRenderer(String.class);
myRenderer.setBackground(new Color(0, 0, 0, 100));

代码示例来源:origin: magefree/mage

mainTable.setForeground(Color.white);
DefaultTableCellRenderer myRenderer = (DefaultTableCellRenderer) mainTable.getDefaultRenderer(String.class);
myRenderer.setBackground(new Color(0, 0, 0, 100));

代码示例来源:origin: realXuJiang/bigtable-sql

private void updateEnabled()
{
 if(null == _origTblColor)
 {
   _origTblColor = _pnl.tblSchemas.getForeground();
 }
 _pnl.btnUpdateSchemas.setEnabled(_pnl.radSpecifySchemas.isSelected());
 _pnl.tblSchemas.setEnabled(_pnl.radSpecifySchemas.isSelected());
 _pnl.cboSchemaTableUpdateWhat.setEnabled(_pnl.radSpecifySchemas.isSelected());
 _pnl.cboSchemaTableUpdateTo.setEnabled(_pnl.radSpecifySchemas.isSelected());
 _pnl.btnSchemaTableUpdateApply.setEnabled(_pnl.radSpecifySchemas.isSelected());
 if(_pnl.radSpecifySchemas.isSelected())
 {
   _pnl.tblSchemas.setForeground(_origTblColor);
 }
 else
 {
   _pnl.tblSchemas.setForeground(Color.lightGray);
 }
}

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

private void updateEnabled()
{
 if(null == _origTblColor)
 {
   _origTblColor = _pnl.tblSchemas.getForeground();
 }
 _pnl.btnUpdateSchemas.setEnabled(_pnl.radSpecifySchemas.isSelected());
 _pnl.tblSchemas.setEnabled(_pnl.radSpecifySchemas.isSelected());
 _pnl.cboSchemaTableUpdateWhat.setEnabled(_pnl.radSpecifySchemas.isSelected());
 _pnl.cboSchemaTableUpdateTo.setEnabled(_pnl.radSpecifySchemas.isSelected());
 _pnl.btnSchemaTableUpdateApply.setEnabled(_pnl.radSpecifySchemas.isSelected());
 if(_pnl.radSpecifySchemas.isSelected())
 {
   _pnl.tblSchemas.setForeground(_origTblColor);
 }
 else
 {
   _pnl.tblSchemas.setForeground(Color.lightGray);
 }
}

代码示例来源:origin: stackoverflow.com

JTable table = new JTable(data, columns);
table.setModel(model);
table.setBackground(Color.LIGHT_GRAY);
table.setForeground(Color.black);
table.setPreferredScrollableViewportSize(new Dimension(500, 70));
table.setFillsViewportHeight(true);

代码示例来源:origin: stackoverflow.com

private JScrollPane textPanel() {
 String header[] = {"Date/Time","Log Entry"};
 String data[][] = 
 {       
     {"18-08-2014 - 16:21","Something"},
     {"18-08-2014 - 16:21","Something"},
     {"18-08-2014 - 16:21","Something"}  
 };
 JTable tPanel = new JTable(data,header);
 tPanel.setFont(new Font(Font.SANS_SERIF,Font.BOLD, 14));
 tPanel.setGridColor(Color.BLACK);
 tPanel.setForeground(Color.WHITE);
 tPanel.setBackground(Color.BLACK);
 tPanel.getTableHeader().setResizingAllowed(false);
 tPanel.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
 TableColumnAdjuster tca = new TableColumnAdjuster(tPanel);
 tca.adjustColumns();
 JScrollPane sPanel;
 sPanel = new JScrollPane(tPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
 sPanel.getViewport().setBackground(Color.BLACK);
 return sPanel;

代码示例来源:origin: hneemann/Digital

/**
 * Called if dialog shows data from running model and model had stopped.
 */
public void detachFromRunningModel() {
  table.setForeground(Color.BLUE);
  table.setToolTipText(Lang.get("msg_dataNotUpdatedAnymore"));
  table.setEnabled(false);
}

代码示例来源:origin: net.sf.cuf/cuf-swing

table.setForeground         (UIManager.getColor("Table.foreground"));
table.setBackground         (UIManager.getColor("Table.background"));
table.setForeground         (UIManager.getColor("ComboBox.disabledForeground"));
table.setBackground         (UIManager.getColor("ComboBox.disabledBackground"));

代码示例来源:origin: no.uib/jsparklines

/**
 * Updates the background color used in the plots.
 *
 * @param evt
 */
private void backgoundColorJComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backgoundColorJComboBoxActionPerformed
  if (((String) backgoundColorJComboBox.getSelectedItem()).equalsIgnoreCase("Black")) {
    heatmapJTable.setGridColor(Color.BLACK);
    heatmapJTable.setBackground(Color.BLACK);
    heatmapJTable.setOpaque(true);
    heatmapJTable.setForeground(Color.WHITE);
  } else { // white
    heatmapJTable.setGridColor(Color.WHITE);
    heatmapJTable.setBackground(Color.WHITE);
    heatmapJTable.setOpaque(true);
    heatmapJTable.setForeground(Color.BLACK);
  }
  // repaint the table to update the plot
  heatmapJTable.revalidate();
  heatmapJTable.repaint();
}//GEN-LAST:event_backgoundColorJComboBoxActionPerformed

代码示例来源:origin: SeeSharpSoft/intellij-csv-validator

private static JTable createRowHeadersTable(final JTable userTable, int startingNumber) {
  final JTable rowHeadersTable = new JBTable(new RowHeadersTableModel(userTable.getModel().getRowCount(), startingNumber));
  // this is where you set the width of the row headers
  rowHeadersTable.createDefaultColumnsFromModel();
  // make the rows look and behave like headers
  rowHeadersTable.setBackground(rowHeadersTable.getTableHeader().getBackground());
  rowHeadersTable.setForeground(rowHeadersTable.getTableHeader().getForeground());
  rowHeadersTable.setFont(rowHeadersTable.getTableHeader().getFont());
  rowHeadersTable.setRowHeight(userTable.getRowHeight());
  rowHeadersTable.getTableHeader().setReorderingAllowed(false);
  rowHeadersTable.setRowSelectionAllowed(true);
  rowHeadersTable.setCellSelectionEnabled(true);
  rowHeadersTable.setFocusable(true);
  rowHeadersTable.setDragEnabled(true);
  rowHeadersTable.setSelectionMode(userTable.getSelectionModel().getSelectionMode());
  return rowHeadersTable;
}

代码示例来源:origin: Microsoft/azure-devops-intellij

@Test
public void testSetLoading_False() {
  resolveConflictsForm.setLoading(false);
  verify(mockTable).setCellSelectionEnabled(true);
  verify(mockTable).setForeground(Color.BLACK);
  verifyNoMoreInteractions(mockTable);
}

代码示例来源:origin: abc9070410/JComicDownloader

table.setForeground(SetUp.getMainFrameTableDefaultColor());
table.addMouseMotionListener(this);

代码示例来源:origin: Multibit-Legacy/multibit-hd

/**
 * @param table       The table to decorate using the standard screen behaviour
 * @param enterButton The button that will respond to the "Enter" key or a double click on a row
 */
public static void applyScreenTheme(final JTable table, final JButton enterButton) {
 table.setFillsViewportHeight(true);
 table.setShowHorizontalLines(true);
 table.setShowVerticalLines(false);
 table.setRowHeight(NORMAL_PLUS_ICON_SIZE + TABLE_SPACER);
 table.setAutoCreateRowSorter(true);
 table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
 table.setRowSelectionAllowed(true);
 table.setColumnSelectionAllowed(false);
 // Apply theme
 table.setForeground(Themes.currentTheme.text());
 // Orientation
 table.applyComponentOrientation(Languages.currentComponentOrientation());
 // Key bindings
 // Override the Swing input map to avoid default behaviour
 table
  .getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
  .put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "Enter");
 table.getActionMap().put("Enter", new AbstractAction() {
  @Override
  public void actionPerformed(ActionEvent e) {
   enterButton.doClick();
  }
 });
}

代码示例来源: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: abc9070410/JComicDownloader

table.setForeground(SetUp.getMainFrameTableDefaultColor());

代码示例来源:origin: abc9070410/JComicDownloader

table.setForeground(SetUp.getMainFrameTableDefaultColor());

代码示例来源:origin: abc9070410/JComicDownloader

volumeTable.setForeground( SetUp.getChoiceFrameTableDefaultColor() );

代码示例来源:origin: net.sf.sfac/sfac-core

@Override
protected void synchronizeEditableState() {
  if (table != null) {
    boolean tableEnabled = isEnabled();
    table.setEnabled(tableEnabled);
    table.setBackground(tableEnabled ? Color.WHITE : Color.LIGHT_GRAY);
    table.setForeground(tableEnabled ? Color.BLACK : Color.DARK_GRAY);
    table.repaint();
    getTableModel().setEditable(isEditable());
  }
  checkActionStates();
}

代码示例来源:origin: Microsoft/azure-devops-intellij

@Test
public void testSetLoading_True() {
  resolveConflictsForm.setLoading(true);
  verify(mockTable).setCellSelectionEnabled(false);
  verify(mockTable).setForeground(Color.GRAY);
  assertFalse(resolveConflictsForm.myAcceptYoursButton.isEnabled());
  assertFalse(resolveConflictsForm.myAcceptTheirsButton.isEnabled());
  assertFalse(resolveConflictsForm.myMergeButton.isEnabled());
  verifyNoMoreInteractions(mockTable);
}

相关文章

JTable类方法