Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jtable Row Span and Column Span

Is there any way to implement row span and colspan in JTable like html table.

like image 547
Milin Avatar asked Jun 01 '11 09:06

Milin


People also ask

What is the difference between Rowspan and Colspan?

The rowspan and colspan are the attributes of <td> tag. These are used to specify the number of rows or columns a cell should merge. The rowspan attribute is for merging rows and the colspan attribute is for merging columns of the table in HTML.

Can we use Rowspan and colspan together?

Of course, you can mix colspan and rowspan to get a range of various tables. Example 4-13 demonstrates a mix of column and row spanning.

How can count number of rows in JTable?

You can use the getRowCount() method: Returns the number of rows that can be shown in the JTable , given unlimited space. If a RowSorter with a filter has been specified, the number of rows returned may differ from that of the underlying TableModel .

What is JTable model?

The TableModel interface specifies the methods the JTable will use to interrogate a tabular data model. The JTable can be set up to display any data model which implements the TableModel interface with a couple of lines of code: TableModel myData = new MyTableModel(); JTable table = new JTable(myData);


1 Answers

Here is a really old example. I don't know if it still works:

http://www.java2s.com/Code/Java/Swing-Components/MultiSpanCellTableExample.htm

like image 66
camickr Avatar answered Sep 20 '22 04:09

camickr