Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Referencing same instance from multiple separate classes.

 
Joe Poyner
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if I am wording this question correctly, but I will give it a shot. BTW, thanks alot for anyones time and help with this question.

So I have a program with 3 classes I have made, what each of them has is listed below each subtitle.

Main
Main class - contains new UI object.

Manipulator
Contains several static classes that analyze modify data based on the inputs and outputs given.

UI
The entire UI interface.

So, here is the question, I create a new UI instance in main. What I need to do is access the getter and setter methods within the UI instance I created from inside Manipulator. Im not exactly sure how to accomplish it. So the options that I thought of were the following, put UI and Manipulator in the same class so that they have access to one another, or use methods in main to pull the desired var's in and then place them. Honestly I would rather just have the instance of UI I create be accessible to Manipulator.

For now I wont post the code because it is getting long and involved but if need be I can.

Thanks again!
[ March 10, 2008: Message edited by: Joe Poyner ]
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch!

It sounds like you're using the Model View Controller (MVC) pattern. That's good. See if these examples help you put it together...

MVC - Multiply.

MVC - Temperature.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic