File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Initializing JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Initializing JTable" Watch "Initializing JTable" New topic

Initializing JTable

shraddha sawant

Joined: Sep 06, 2011
Posts: 12

Hi, I have a JScrollPane and JTable in it.
I want to initialize that table at run time. using following code.
But it is not updating frame.
I think i am missing some method like repaint() for JFrame.
Please tell me a code using which i can refresh the JFrame and other mistakes in the following code.
below is the code:

Darryl Burke

Joined: May 03, 2008
Posts: 5115

shraddha , since your problem is not the same as the one in the nearly 3 year old thread you posted in, I've moved it to a thread of its own.

To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem.

edit: Before that, read the API for JScrollPane and follow the link to the tutorial on How to Use Scroll Panes where you will learn how to correctly show a JTable or other component in a JScrollPane.

luck, db
There are no new questions, but there may be new answers.
John Jai

Joined: May 31, 2011
Posts: 1776
Check how to dynamically change scroll pane content in How to use Scroll Panes
I agree. Here's the link:
subject: Initializing JTable
It's not a secret anymore!