Skip to Main Content

Java SE (Java Platform, Standard Edition)

help with ScrollPane

REDO LOGDec 18 2011 — edited Dec 18 2011
Hi all



I am about building a java desktop application that query a database and show the results

the results are stoked in a jtable, to show the results, i did the following :

//tabledb: an instance of a class that execute the query and save the results in a jtable named donnee (tabledb.donnee, donnee is a field in the class retrieving data )


JScrollPane jScrollPane2 = new JScrollPane(tabledb.donnee);
JPanel buttonPanel = new JPanel();

JFrame fr = new JFrame();

fr.getContentPane().add( buttonPanel, BorderLayout.SOUTH );

fr.getContentPane().add(jScrollPane2);

fr.pack();

fr.setVisible(true);


its works fine, but now I am trying to show in the frame where i have entered the query: ie i dont wont to create another jframe to show the table of results

I tried this :


jScrollPane2.add(tabledb.donnee); //jScollPane2 is declared before, actually I am working with swing framework where I can drag and drop component (jScollPane2 is draged
// and droped into the main frame



JPanel buttonPanel = new JPanel();



this.getContentPane().add( buttonPanel, BorderLayout.SOUTH );

this.getContentPane().add(jScrollPane2);

this.pack();

this.setVisible(true);



but when i run the application i issued a query and no changes in the jScollPane2, no results



did i miss something or I have problem in my conception??

thanks in advance

regards rachid
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 15 2012
Added on Dec 18 2011
1 comment
1,099 views