• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

object problem

 
narasimharao konjeti
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello, I have one singleton class,in that main class, i instantiated one class A , object is "a" , i have to access the method of the class A without using object name "a" through my entire module in other classes. how can i do it? MY class "A" is log file.

waiting for reply.
regards
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Please post your code if you can. The question remains unclear to me, so it would be great if you can try explain in little more details.
Regards
Maulin
 
narasimharao konjeti
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, for the clear question, just open microsoft word/acces/excel. there is one menu called "help", for that there is one menu item called "what is this?". I have to implement the functionality like that in my desktop application. how can i do it. here in my application i can popup message like access/word. or i can disable the functionality of mouse left button. So please tell, how to popup a message,, or else how to disable the functionality of mouse left button. I am using swings for my desktop
regards
 
narasimharao konjeti
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am sorry forthe above description.
that is another forum question.
i am sorry
 
narasimharao konjeti
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my problem is, i want to create on object to write the messages in file. that object should be available for the entire application. to write log messages
thankd
nr konjeti
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like you need to implement the Singleton pattern. Below is a generalized example:

Now, anywhere you want to access this instance of A, you simply call A.getInstance().
Hope this helps,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic