This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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
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
Joined: May 20, 2003
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 ]