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

Refreshing a JScrollPane...

David Thompson

Joined: May 20, 2003
Posts: 3
I am stumped!!! Here is my problem....I have four classes...
Main...the application
Buttons... A JPane of Jbuttons
Viewpane... extends JScrollPane
Action.. extends ActionEventHandler
The main class builds a GUI by calling the other classes from it's default constructor. The viewport on the JScrollPane needs to be refreshed when I click on a button, but I'm not sure how to implement this. I am having trouble accessing methods in my JScrollPane class from the Action class. Any suggestions would be greatly appreciated. thanks
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
when you say refreshed, do you just mean redrawn or do you mean repositioned?
As to the accessible methods, have you made the methods for ViewPane public so that Action can use them? Action also needs some way of getting a handle on the instance of ViewPane you have running. That may be your problem. You may need to pass a reference of your Viewpane object to your Action object for it to hold on to and use.
David Thompson

Joined: May 20, 2003
Posts: 3
when you say refreshed, do you just mean redrawn or do you mean repositioned?
Actually...ViewPane (which extends JScrollPane) has a viewable area that is a JTextPane. This JTextPane is built by parsing an XML file. What I need to do is have an accessible method from the ViewPane class that parses the file and performs a setText() on the JTextPane.
I would like to make this method available for all classes because the ViewPane will be changed by many different classes.
Right now I think the problem lies in the fact that Buttons is attached to Main and Action is attached to Buttons. Action can't see ViewPane because ViewPane is only attached to Main. I need some way of making the ViewPane object and it's methods available to all other objects.
Thanks again in advance for the replies. Maybe the problem is with the overall application structure. I am open to all suggestions.
[ May 21, 2003: Message edited by: David Thompson ]
I agree. Here's the link:
subject: Refreshing a JScrollPane...
It's not a secret anymore!