Who is the caller and who is the callee in this callback pattern?

Hi,
Could someone tell me which method is the caller and which is the callee in the following code? Please be as detailed as possible in your explanation.
Thank you in advance!
public class TimePrinter implements ActionListener {
     public void actionPerformed(ActionEvent evt) {
          Date now = new Date();
          System.out.println("At the tone, the time is " + now);
          Toolkit.getDefaultToolkit().beep();
public class TimerTest {
     public static void main(String[] args) {
          ActionListener listener = new TimePrinter();
          int delay = 10000; //Delays 10 seconds
          //Constructs a timer that calls the listener once every 10 seconds.
          Timer t = new Timer(delay, listener);
          t.start();
          JOptionPane.showMessageDialog(null, "Quit program?");
          System.exit(0);
}

jverd,
Thank you again for responding to this thread!
Here is the code:
//TimePrinter.java
import java.util.*;
import java.awt.*;
import java.awt.event.*;
public class TimePrinter implements ActionListener {
      public void actionPerformed(ActionEvent evt) {
             Date now = new Date();
             System.out.println("At the tone, the time is " + now);
             Toolkit.getDefaultToolkit().beep();
//TimerTest.java
import java.awt.event.*;
import javax.swing.*;
import javax.swing.Timer;
import java.util.*;
import java.awt.*;
public class TimerTest {
        public static void main(String[] args) {
                ActionListener listener = new TimePrinter();
                int delay = 10000; //Delays 10 seconds
               //Constructs a timer that calls the listener once every 10 seconds.
               Timer t = new Timer(delay, listener);
               t.start();
              JOptionPane.showMessageDialog(null, "Quit program?");
              System.exit(0);
}Prior to posting to this forum, I actually have done some research and learned the following:
"A callback in programming is executable code that is passed as an argument to other code. "
With this definition, in the above example "actionPerformed" in the TimePrinter class is the executable code, it's being passed to Timer(delay, listener). So the caller here is Timer(delay, listener), callee is the actionPerformed() method, as it is the method that is being called. This is how I interpret it. Am I correct? My question is still which is the caller and callee in this example.
Note, I don't come here often and didn't even know that you could format the text. I formated my msg as you requested, don't know how the text will turn out.
Regards,
Eric
One more question: I tried formatting by placing my code like this my source, what it did is to place the text in a blue area but didn't indent like the source did (I manually indented it). How do I keep the format as the original code?
Edited by: ericdunn on Jul 29, 2009 12:40 PM
Edited by: ericdunn on Jul 29, 2009 12:45 PM

Similar Messages

Maybe you are looking for

  • My lock button is broken and i cant figure out how to turn my phone on with my computer, any tips?

    my lock button is jammed and i read somewhere that you can turn your phone on through itunes. i have tried plugging it up to a charger and doing everything you can imagine to get the button unjammed. i cant figure out how to use itunes to get it to t

  • Calculating Accumulative Value for a particular period

    Hi, I want to calculate acumulative values based on 0calmonth for a key figure. In Rows, i want 0calmonth and a key figure in Columns. If we select the property of the key figure as "Cumulative". It is adding values like in first month, first month v

  • Importing structure to ESR

    hi I am in PI 7.1. I have a file to AII scenario. The file server guys gaveme the xsd. I need to two mappings for the target. depending on the value of one field I have to use one of the mappings. I am planning to use multiple operations in single in

  • How do I delete time capsule files and starting over

    I installed a time capsule last week and backed up my HD using TM. After doing that, I started moving large movie files from my HD to an external drive, and backing up both the HD and external on the TC. Even though I have only 130 G worth of files i

  • Getting lot of errors like :0x408 in /var/adm/messages file in Solaris 10

    Hi, Can anyone help me regarding the following errors being found in the /var/adm/messages file: Nov 24 03:36:07 x9ce1 :0x408 Nov 24 03:36:07 x9ce1 dtcp: [ID 702911 kern.notice] WARNING GW (dtcp_klib.c,198) (53449,33458) (0xac120fd5,0xac126503) Nov 2