aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Passing a JScrollPane to a JDialog Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Passing a JScrollPane to a JDialog" Watch "Passing a JScrollPane to a JDialog" New topic
Author

Passing a JScrollPane to a JDialog

Rames Raja
Greenhorn

Joined: Jan 27, 2003
Posts: 7
Hi all,
I am passing a JScrollPane from my applet to a JDialog so that I can display the same table that resides inside my JScrollPane.
My dialog is displaying the JScrollPane well , but it seems like my JScrollPane is being removed from my original applet. Applet no longer displays the JScrollPane.
Here is how I call my JDialog
new PrintDialog( new javax.swing.JFrame(),true ,VSW_scrollPane ,this ).show();

and inside my PrintDialog I am adding VSW_scrollPane ( js ) to a panel:
middlePanel.add(js , java.awt.BorderLayout.CENTER);

what you think the problem is ??
Thanks in advance.
Ramesh
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
I can't make out from your code whether you are adding the exact same instance of the scrollpane to your dialog or if you are making a new instance to add to the dialog. I don't think you can use the same instance of a swing component in 2 places at once... you could create a clone of the one to put in the dialog, although I don't know that you can have them both use the same table for the same reason. You'd probably have to set up a seperate table as well and just have both tables call on the same data to fill them both in.
HTH
 
Consider Paul's rocket mass heater.
 
subject: Passing a JScrollPane to a JDialog
 
Similar Threads
Having difficulty sizing a viewport to fit inside a JDialog...any suggestions?
About JScrollPane
JTable viewing problem
How to get rid of "Java Applet Window" from JDialog
Giving focus(visibility) to "obsured" window/component...