Handlers

import java.awt.*;

import java.awt.event.ActionListener;

public class FunctionPanel extends KeyPanel {

public FunctionPanel(Calculator calculator) {

super(calculator);

ActionListener handler = getOperationHandler();

//GridLayout(rows, columns, hgap, vgap)

setLayout(new GridLayout(2, 3, 5, 10));

addKey("C", "Clear", handler);

addKey("SQR", "Square", handler);

addKey("SQRT", "SquareRoot", handler);

addKey("1/X", "Inverse", handler);

addKey("MR", "MemoryRecall", handler);

addKey("MC", "MemoryClear", handler);

addKey("M-", "MemoryMinus", handler);

addKey("M+", "MemoryPlus", handler);

}

}

This program works perfect. What I was wondering if anyone could help me with is the line

ActionListener handler = getOperationHandler();

Does anyone know what this keyword means. I mean I know what an actionListener is but I don't understand the getOperationHandler(), keyword, how does this handle all of the operations.

[1042 byte] By [zimbaa] at [2007-10-2 13:41:53]
# 1
Post code in [url= http://forum.java.sun.com/help.jspa?sec=formatting]code tags[/url].getOperationHandler is not a key word, it is a method call, but as KeyPanel is not part of the standard API, we can not tell you what it does, you would need to look at KeyPanel API documentation.
mlka at 2007-7-13 11:35:53 > top of Java-index,Java Essentials,Java Programming...
# 2
Thats okay I'll do without it for now.
zimbaa at 2007-7-13 11:35:53 > top of Java-index,Java Essentials,Java Programming...