Results 1 to 4 of 4
- 03-08-2009, 10:02 PM #1
Member
- Join Date
- Sep 2008
- Posts
- 40
- Rep Power
- 0
JTable doesnt show columun names!
Hello. I'm trying to use JTable in my application and at the same time using tabbes to switch between my different JPanels. And within one of them panels i've got a JTable showing but it doesn't show the columun names of the cells! I'm really stuck in the mud :-(. This is my code:
public class EditPanel extends MainPanel { //inherit MainPanel
JPanel editPane;
final JTable table;
public EditPanel(){
String data[][] = {{"vinod","BCA","A"},{"Raju","MCA","b"},
{"Ranjan","MBA","c"},{"Rinku","BCA","d"}};
String col[] = {"Course","Grade"};
editPane = new JPanel();
table = new JTable(data,col);
tabs.addTab("Edit", editPane);
editPane.setLayout(new BorderLayout());
editPane.add(table, BorderLayout.SOUTH);
editPane.setOpaque(true);
}
}
Can anybody see where i'm going wrong please? Driving me nuts
-
first put the jtable into a jscrollpane, THEN place it in your jpanel. Either that or you will have to take pains to display the table header -- usually placing the table in its own panel borderlayout.center and the header borderlayout.north. Easiest though is my first recommendation.
- 03-08-2009, 10:32 PM #3
Member
- Join Date
- Sep 2008
- Posts
- 40
- Rep Power
- 0
Excellent! I'm so happy you've helped me out! I'm thankfully greatfull!
-
Similar Threads
-
java doesnt allow vista to work
By 10rosas in forum New To JavaReplies: 5Last Post: 12-22-2008, 04:23 PM -
Jtable duplicates through Hashtable (JTable condition problem) my assignment plz help
By salmanpirzada1 in forum Advanced JavaReplies: 2Last Post: 05-15-2008, 10:15 AM -
netbeans 6.0 not show commpunent or show blank page
By fahimaamir in forum NetBeansReplies: 1Last Post: 01-26-2008, 06:20 AM -
Drive names
By alwz_nikhil in forum New To JavaReplies: 0Last Post: 11-28-2007, 10:04 AM -
My program doesnt display anything
By Bojevnik in forum AWT / SwingReplies: 2Last Post: 10-19-2007, 02:50 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks