Drawing A Table On A Container(Panel)

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2004
Posts: 9
Reputation: bobinson is an unknown quantity at this point 
Solved Threads: 0
bobinson bobinson is offline Offline
Newbie Poster

Drawing A Table On A Container(Panel)

 
0
  #1
Aug 1st, 2004
Hi,
Pls how can I draw a table on a panel with java.The table with five rows and ten columns.
Thank you.
Bobinson.
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 1,749
Reputation: nanosani is an unknown quantity at this point 
Solved Threads: 54
Team Colleague
nanosani's Avatar
nanosani nanosani is offline Offline
Unauthenticated Liar

Re: Drawing A Table On A Container(Panel)

 
0
  #2
Aug 8th, 2004
try using JTable .... study the JTable APIs and you'll know what you have to do.
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 9
Reputation: bobinson is an unknown quantity at this point 
Solved Threads: 0
bobinson bobinson is offline Offline
Newbie Poster

Re: Drawing A Table On A Container(Panel)

 
0
  #3
Aug 17th, 2004
/*Hello everybody out there!,

I found out that JTable class of the swing package allows one to draw a table on a container.It's as simple as creating the object of the class and passing two arguments into its construct,the first being number of rows and the second the number of columns.Then you go on ahead to add the object on to the container.(panel)

something like this...*/

import javax.swing. *;

class DrawTable
{
static JPanel panel;
static JTable table;
static JFrame frame;

public static void main(String args[])
{
panel=new JPanel();
table=new JTable(4,6);
panel.add(table);
frame = new JFrame("Table");
frame.getContentPane().add(panel);
frame. setSize(230,230);
frame.setVisible(true);

}
}

/*Now here's my problem.
How can I go about inserting values into the table?
Also,can I increase the size(width and height) of the cells?,
Is there any other thing I could do with this table apart fro inserting values and increasing its size?

I'll quite appreciate your contributions.Thanks */
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 1,749
Reputation: nanosani is an unknown quantity at this point 
Solved Threads: 54
Team Colleague
nanosani's Avatar
nanosani nanosani is offline Offline
Unauthenticated Liar

Re: Drawing A Table On A Container(Panel)

 
0
  #4
Aug 19th, 2004
see the JTable methods in the APIs... you'll find how to resize and insert in the cells of the table.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 9421 | Replies: 3
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC