Witam, mam taki kod:
class Tworz_Auta{
public Tworz_Auta(JPanel auto)
{
auto.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.gridwidth = GridBagConstraints.REMAINDER;
c.weightx = 1.0;
c.weighty = 1.0;
final DefaultTableModel dtm=new DefaultTableModel(null, new Object[] {"Zdjecie", "Typ","Rok produkcji"});
final JTable tabela=new JTable(dtm);
/*{
}
public Class getColumnClass(int column)
{
return getValueAt(0, column).getClass();
}
};
*/
//setting grid color
tabela.setGridColor(Color.red);
tabela.getColumnModel().getColumn(0).setCellRenderer(new MyRenderer2());
tabela.getColumnModel().getColumn(1).setCellRenderer(new MyRenderer2());
tabela.getColumnModel().getColumn(2).setCellRenderer(new MyRenderer2());
//tabela.setGridColor(Color.red);
tabela.setBackground(Color.LIGHT_GRAY);
tabela.setTableHeader(null);
tabela.setRowHeight(100);
String[] kat = {"A1","A","B1"};
for(int i=0;i<3;i++)
{
Object[] dataa = {kat[i],"dasdadas","dsadas"};
dtm.addRow(dataa);
}
JScrollPane xx = new JScrollPane(tabela);
xx.setBorder(null);
auto.add(xx,c);
}
}
class MyRenderer2 extends DefaultTableCellRenderer {
/*
* @see TableCellRenderer#getTableCellRendererComponent(JTable, Object, boolean, boolean, int, int)
*/
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus,
int row, int column) {
// ImageIcon icon = new ImageIcon(getClass().getResource("images/moon.gif"));
if(isSelected)
{
setBackground(new Color(110,198,216));
setForeground(Color.white);
}
else
{
setBackground(Color.white);
setForeground(Color.black);
}
setFocusable(true);
if(column==0)
{
//super.printBorder(null);
setHorizontalAlignment(SwingConstants.CENTER);
ImageIcon znaczki = new ImageIcon("auta/audia6.jpg");
// setText((String)value);
setIcon(znaczki);
setBackground(new Color(240,240,240));
if(isSelected)
{
setBackground(new Color(110,198,216));
setForeground(Color.black);
}
}
else
{
setText((String)value);
}
return this;
}
}
Chcialbym usunac w nich obramowanie... probowalem juz prawie wszystkiego i nic nie dziala :( wiec porazka. Pomozcie :) Powiedzcie tez czy jest mozliwosc usuniecia obramowanie tylko z jednej kolumny??