List of usage examples for javax.swing.table JTableHeader setOpaque
@BeanProperty(expert = true, description = "The component's opacity") public void setOpaque(boolean isOpaque)
From source file:nl.phanos.liteliveresultsclient.gui.ResultsWindows.java
private void initCustumComponents() { logoLabel = new javax.swing.JLabel(); icon = new ImageIcon(getCLub()); logoLabel.setIcon(icon); // NOI18N logoLabel.setBounds(this.getWidth() - icon.getIconWidth(), this.getHeight() - icon.getIconHeight(), icon.getIconWidth(), icon.getIconHeight()); LayerdPane.add(logoLabel, JLayeredPane.PALETTE_LAYER); clockLabel = new javax.swing.JLabel(); clockLabel.setFont(new java.awt.Font("Lucida Grande", 0, fontSize)); // NOI18N clockLabel.setText(""); clockLabel.setForeground(Color.YELLOW); LayerdPane.add(clockLabel, JLayeredPane.PALETTE_LAYER); jTable1.setRowSelectionAllowed(false); jTable1.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {}, new String[] { "Plaats", "Atleet", "Tijd" }) { Class[] types = new Class[] { java.lang.Integer.class, java.lang.String.class, java.lang.String.class }; boolean[] canEdit = new boolean[] { false, false, false }; public Class getColumnClass(int columnIndex) { return types[columnIndex]; }/*from w w w .j a v a 2 s. com*/ public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit[columnIndex]; } }); jScrollPane1.getViewport().setBackground(Color.black); this.setBackground(Color.black); JTableHeader header = jTable1.getTableHeader(); header.setOpaque(false); jPanel1.setBackground(Color.black); header.setBackground(Color.black); header.setForeground(Color.YELLOW); DefaultTableCellRenderer headerRenderer = new DefaultTableCellRenderer(); headerRenderer.setBackground(Color.BLACK); for (int i = 0; i < jTable1.getModel().getColumnCount(); i++) { if (jTable1.getModel().getColumnCount() > 0) { jTable1.getColumnModel().getColumn(i).setHeaderRenderer(headerRenderer); } } DefaultTableCellRenderer LEFTRenderer = new DefaultTableCellRenderer(); LEFTRenderer.setHorizontalAlignment(JLabel.LEFT); jTable1.getColumnModel().getColumn(0).setCellRenderer(LEFTRenderer); ChangeFont(fontSize); }