•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 397,615 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,467 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 5211 | Replies: 3
![]() |
•
•
Join Date: Jul 2004
Posts: 6
Reputation:
Rep Power: 0
Solved Threads: 0
/*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 */
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 */
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
- Table Layout Pannels (C#)
- Trouble rending form in firefox and netscape. (ASP.NET)
- Data Item (ASP.NET)
- Style properties are ignored by Mozilla browser... (ASP.NET)
- how to reduce time required to add panel to container (Java)
- Container Table for Exact Positioning in all Res (JavaScript / DHTML / AJAX)
Other Threads in the Java Forum
- Previous Thread: 37049
- Next Thread: class designs in java-air traffic controller system--need help!!



Linear Mode