Changing the cells atribute in JTable

Can You help me change the first row background & font color and to bold font in my table - and a question if I use swing must I import awt libraties?

I've read that if smbd use swing than he should stay away from awt in term not to mix these two technologies - how do You know that You are using a SWING or an AWT library?

Thanks in advance, smartduck

here is my code:

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class Inventory2_17 {

public JPanel buildUI() {

JPanel panel = new JPanel();

panel.setBorder(BorderFactory.createEmptyBorder(50, //zgoraj

50, //levo

50, //spodaj

50) //desno

);

Object[][] data = {{"Item Num","Item Name","Units","On hand"},

{"B1242","Bolt","Each","1000"},{"N1242","Nut","Each","1200"},{"W1242","Washer","Each","1150"},{"N2323","Nails","Lbs","2250"}};

Object[] stolpci = {"0","1","2","3"};

JTable table = new JTable(data,stolpci);

table.setRowHeight(30);

table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

for (int i=0;i<stolpci.length;i++) {

table.getColumnModel().getColumn(i).setMinWidth(180);

}

panel.add(table);

return panel;

}

public static void main(String[] args) {

JFrame.setDefaultLookAndFeelDecorated(true);

JFrame frame = new JFrame("Congratulations!! You are a good student.");

Inventory2_17 app = new Inventory2_17();

frame.getContentPane().add(app.buildUI(), BorderLayout.CENTER);

frame.pack();

frame.setVisible(true);

}

}>

[1622 byte] By [smartducka] at [2007-11-27 0:52:19]
# 1
Just read the tutorial, would you? Everything you need to know is there, it is pointless to ask uninformed questions here before you read it. http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
DrClapa at 2007-7-11 23:23:46 > top of Java-index,Java Essentials,Java Programming...