JTable

Hi everyone,i have a question about how to implement a JTable which have headers for the rows and the colums, not like the usual ones, only for the columns. Any idea how to do it? Many Thanks
[205 byte] By [patucosa] at [2007-10-2 17:22:05]
# 1
Headers don't make sense for table rows. Each row is its own instance of the data set. How could the table determine what would be the appropriate label? You could make the first column of the table a "Description" column and have each row of data include an entry for that row.
BaltimoreJohna at 2007-7-13 18:38:12 > top of Java-index,Desktop,Core GUI APIs...
# 2
Headers becomes all sense, e.g., when they represent a square matrix where [1..n] [1..n] elements have to be shown. Obviously, in the problem i am facing the numbers to be displayed on the headers won't be 1..n so as some text depending on the row, so i though about it.
patucosa at 2007-7-13 18:38:12 > top of Java-index,Desktop,Core GUI APIs...
# 3
Use a row header. Something like this: http://forum.java.sun.com/thread.jspa?forumID=57&threadID=594338
camickra at 2007-7-13 18:38:12 > top of Java-index,Desktop,Core GUI APIs...
# 4
Thanks,i will take a look and in a while ill post what happen with the rows.Thanks
patucosa at 2007-7-13 18:38:12 > top of Java-index,Desktop,Core GUI APIs...
# 5

Hi,

i have created a row whith the same index as the column header, but the question is i do not know what i have to implemet to make the lines which divide the cells visible?

Another question, is it possible to create a "multi row header"? I know how to iplement a multi header but not with the row restrictions.

Any idea? Thanks

String[] columnNames = {"0","1","2","3","4","5"};

JList rowHeader = new JList(columnNames);

JTable table = new JTable(cLogical.getWColision(), columnNames);

JScrollPane scroll = new JScrollPane(table);

rowHeader.setFixedCellWidth(50);

rowHeader.setFixedCellHeight(table.getRowHeight() );

rowHeader.setOpaque(true);

rowHeader.setBorder(table.getBorder());

rowHeader.setForeground(table.getForeground());

rowHeader.setBackground(table.getBackground());

rowHeader.setFont(table.getFont());

scroll.setRowHeaderView(rowHeader);

patucosa at 2007-7-13 18:38:12 > top of Java-index,Desktop,Core GUI APIs...
# 6

Hi,

i have created a row whith the same index as the

column header, but the question is i do not know what

i have to implemet to make the lines which divide the

cells visible?

Another question, is it possible to create a "multi

row header"? I know how to iplement a multi header

but not with the row restrictions.

Any idea? Thanks

String[] columnNames = {"0","1","2","3","4","5"};

JList rowHeader = new JList(columnNames);

JTable table = new JTable(cLogical.getWColision(),

columnNames);

JScrollPane scroll = new JScrollPane(table);

rowHeader.setFixedCellWidth(50);

rowHeader.setFixedCellHeight(table.getRowHeight()

) );

rowHeader.setOpaque(true);

rowHeader.setBorder(table.getBorder());

rowHeader.setForeground(table.getForeground());

rowHeader.setBackground(table.getBackground());

rowHeader.setFont(table.getFont());

scroll.setRowHeaderView(rowHeader);

patucosa at 2007-7-13 18:38:12 > top of Java-index,Desktop,Core GUI APIs...