|
-
October 21st, 1999, 11:29 PM
#1
how to create a jtable header that takes up 2 lines ?
how do i create a jtable header that takes up 2 lines ?
such as below ?
| Sex |
| M | F |
Thanks again
http://members.xoom.com/lookads
-
October 22nd, 1999, 07:47 PM
#2
Re: how to create a jtable header that takes up 2 lines ?
-
October 24th, 1999, 08:25 PM
#3
Re: how to create a jtable header that takes up 2 lines ?
cannot compile the source code at
http://www2.gol.com/users/tame/swing...Examples2.html
because it imports user defined classes.
so, how now ?
http://members.xoom.com/lookads
-
October 24th, 1999, 09:27 PM
#4
Re: how to create a jtable header that takes up 2 lines ?
Which example you were trying to compile ?
-
October 25th, 1999, 01:43 AM
#5
Re: how to create a jtable header that takes up 2 lines ?
the example is this, as below. it could not compile :-
http://www2.gol.com/users/tame/swing...erExample.java
/* (swing1.1beta3)
*
* |-----------------------------------------------------|
* | | Name | Language |
* | |-----------------|--------------------------|
* | SNo. | | | | Others |
* | | 1 | 2 | Native |-----------------|
* | | | | | 2 | 3 |
* |-----------------------------------------------------|
* | | | | | | |
*
*/
//package jp.gr.java_conf.tame.swing.examples;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import jp.gr.java_conf.tame.swing.table.*;
/**
* @version 1.0 11/09/98
*/
public class GroupableHeaderExample extends JFrame {
GroupableHeaderExample() {
super( "Groupable Header Example" );
DefaultTableModel dm = new DefaultTableModel();
dm.setDataVector(new Object[][]{
{"119","foo","bar","ja","ko","zh"},
{"911","bar","foo","en","fr","pt"}},
new Object[]{"SNo.","1","2","Native","2","3"});
JTable table = new JTable( dm ) {
protected JTableHeader createDefaultTableHeader() {
return new GroupableTableHeader(columnModel);
}
};
TableColumnModel cm = table.getColumnModel();
ColumnGroup g_name = new ColumnGroup("Name");
g_name.add(cm.getColumn(1));
g_name.add(cm.getColumn(2));
ColumnGroup g_lang = new ColumnGroup("Language");
g_lang.add(cm.getColumn(3));
ColumnGroup g_other = new ColumnGroup("Others");
g_other.add(cm.getColumn(4));
g_other.add(cm.getColumn(5));
g_lang.add(g_other);
GroupableTableHeader header = (GroupableTableHeader)table.getTableHeader();
header.addColumnGroup(g_name);
header.addColumnGroup(g_lang);
JScrollPane scroll = new JScrollPane( table );
getContentPane().add( scroll );
setSize( 400, 120 );
}
public static void main(String[] args) {
GroupableHeaderExample frame = new GroupableHeaderExample();
frame.addWindowListener( new WindowAdapter() {
public void windowClosing( WindowEvent e ) {
System.exit(0);
}
});
frame.setVisible(true);
}
}
http://members.xoom.com/lookads
-
October 25th, 1999, 07:13 PM
#6
Re: how to create a jtable header that takes up 2 lines ?
What errors you are getting ? Did you download all the 4 files ????
If not , download all the 4 files . If yes , try to compile those files like this..
c:\> javac.exe GroupableHeaderExample.java ColumnGroup.java GroupableTableHeader.java GroupableTableHeaderUI.java
Before you compile , comment all "package ... " code.
I did compile those files in my machine. It's working fine.
Poochi..
-
October 25th, 1999, 10:30 PM
#7
Yes. You're right.
Yes. It works. I did not know that i have to download all the files you specified.
Previously, i only downloaded 1 file and tried to compile.
Now, it works.
Thanks a lot.
http://members.xoom.com/lookads
-
October 25th, 1999, 10:40 PM
#8
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|