943,839 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 15209
  • Java RSS
Aug 1st, 2004
0

Drawing A Table On A Container(Panel)

Expand Post »
Hi,
Pls how can I draw a table on a panel with java.The table with five rows and ten columns.
Thank you.
Bobinson.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bobinson is offline Offline
9 posts
since Jul 2004
Aug 8th, 2004
0

Re: Drawing A Table On A Container(Panel)

try using JTable .... study the JTable APIs and you'll know what you have to do.
Team Colleague
Reputation Points: 45
Solved Threads: 56
Unauthenticated Liar
nanosani is offline Offline
1,767 posts
since Jul 2004
Aug 17th, 2004
0

Re: Drawing A Table On A Container(Panel)

/*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 */
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bobinson is offline Offline
9 posts
since Jul 2004
Aug 19th, 2004
0

Re: Drawing A Table On A Container(Panel)

see the JTable methods in the APIs... you'll find how to resize and insert in the cells of the table.
Team Colleague
Reputation Points: 45
Solved Threads: 56
Unauthenticated Liar
nanosani is offline Offline
1,767 posts
since Jul 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: 37049
Next Thread in Java Forum Timeline: class designs in java-air traffic controller system--need help!!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC