A class from which a method is being called

  • Thread starter Michael Preminger
  • Start date
M

Michael Preminger

I am interested in finding the class (hereunder: the calling class) from
which a method (hereunder: calling method) is calling the method I am
writing (herunder: the present method).

The present method uses JOptionPane.showMessageDialog() to write a
message, but I wish to title this messageDialog with the name of the
calling class.

I have found a sketch to a somewhat implementation-sensitive way of
doing it, in the following message:
http://www.google.com/groups?hl=en&...afa06&[email protected]#link4

I wonder: This sketch is from 1999. Has Sun, since that time come with a
more generic way to accomplish this?

thanks !!

Michael
 
D

Daniel Bonniot

I wonder: This sketch is from 1999. Has Sun, since that time come with a
more generic way to accomplish this?

Partly. You could still use an exception, but if you have JDK 1.4 or later,
you can use the getStrackTrace() method of class Throwable to have a higher
level view on the trace elements.

Daniel

The Nice programming language: http://nice.sf.net
 

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

Forum statistics

Threads
473,754
Messages
2,569,526
Members
44,997
Latest member
mileyka

Latest Threads

Top