logging

J

joxy

Hello, how is that i can create an object which can be used by the
other classes in my project, so they can use the logging service...
since I have used many classes extending JFrame, and JInternalFrame, i
cannot extend from any other class else... so what would you recommend
to me? using interfaces? (i need implemented code)
 
I

Ian Wilson

joxy said:
Hello, how is that i can create an object which can be used by the
other classes in my project, so they can use the logging service...
since I have used many classes extending JFrame, and JInternalFrame, i
cannot extend from any other class else... so what would you recommend
to me? using interfaces? (i need implemented code)

I'd pass an instance as a parameter to the constructors of the many
classes. Or to a method written to accept it.

e.g.

MyObject myObj = new MyObject();

MyClass1 mc1 = new MyClass1(myObj);

MyClass2 mc2 = new MyClass2();
mc2.setMyObject(myObj);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,114
Latest member
GlucoPremiumReview
Top