aspose file tools*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Refreshing a JScrollPane..." Watch "Refreshing a JScrollPane..." New topic
Author

Refreshing a JScrollPane...

David Thompson
Greenhorn

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.
hth
Chris
David Thompson
Greenhorn

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 ]
 
 
subject: Refreshing a JScrollPane...
 
Similar Threads
thread and returning a method from object
Real Quick, whats wrong with my JScrollPane
Getting a connection object in a businesslogic class (outside Action class)
Problem with Adding JScrollPane to JPanel!
Help on scope and default constructors