Bei mir geht's:Stiewen hat gesagt.:-.- geht aber nicht -.-
//package tableDemo;
/*
* TableBackground2.java
*/
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
public class TableBackground2 extends JFrame {
public TableBackground2() {
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
table = new JTable();
table.setModel(new DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
getContentPane().add(new JScrollPane(table), BorderLayout.CENTER);
table.getParent().setBackground(table.getBackground());
pack();
}
public static void main(String args[]) {new TableBackground2().setVisible(true);}
private JTable table;
}
jtbTable = new JTable(database.strData, database.strHead);
jtbTable.setBackground(database.colBaGr);
jtbTable.setForeground(database.colFoGr);
jtbTable.setRowHeight(20);
jtbTable.setGridColor(database.colMenuBack);
jtbTable.setEnabled(false);
jtbTable.setFont(database.foMyFont);
add(new JScrollPane(jtbTable), BorderLayout.CENTER);
Schaut ja gut aus. Fehlt nur ne Kleinigkeit:Stiewen hat gesagt.:...Habs net hinbekommen und schick hier noch mal meinen Source...
jtbTable = new JTable(database.strData, database.strHead);
jtbTable.setBackground(database.colBaGr);
jtbTable.setForeground(database.colFoGr);
jtbTable.setRowHeight(20);
jtbTable.setGridColor(database.colMenuBack);
jtbTable.setEnabled(false);
jtbTable.setFont(database.foMyFont);
add(new JScrollPane(jtbTable), BorderLayout.CENTER);
jtbTable.getParent().setBackground(jtbTable.getBackground());//<--------HIER