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 Passing a JScrollPane to a JDialog Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Passing a JScrollPane to a JDialog" Watch "Passing a JScrollPane to a JDialog" New topic

Passing a JScrollPane to a JDialog

Rames Raja

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.
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.
I agree. Here's the link:
subject: Passing a JScrollPane to a JDialog
It's not a secret anymore!