public class IJEventMulticaster extends AWTEventMulticaster implements DisplayChangeListener
Example how to implement an object, which fires DisplayChangeEvents using the IJEventMulticaster:
public mySpecialWindow extends StackWindow {
DisplayChangeListener dclistener = null;
public synchronized void addDisplayChangeListener(DisplayChangeListener l) {
dclistener = IJEventMulticaster.add(dclistener, l);
}
public synchronized void removeDisplayChangeListener(DisplayChangeListener l) {
dclistener = IJEventMulticaster.remove(dclistener, l);
}
public void myEventFiringMethod(arguments) {
... code ...
if (dclistener != null) {
DisplayChangeEvent dcEvent = new DisplayChangeEvent(this, DisplayChangeEvent.Z, zSlice);
dclistener.displayChanged(dcEvent);
}
... code ...
}
... other methods ...
}
To put in a new event-listener (by changing this class or extending it):
- Add the listener to the "implements" list.
- Add the methods of this listener to pass on the events (like displayChanged).
- Add the methods "add" and "remove" with the corresponding listener type.
a, b
Modifier and Type | Method and Description |
---|---|
static DisplayChangeListener |
add(DisplayChangeListener a,
DisplayChangeListener b)
Adds DisplayChange-listener-a with DisplayChange-listener-b and
returns the resulting multicast listener.
|
void |
displayChanged(DisplayChangeEvent e)
Handles the DisplayChange event by invoking the
displayChanged methods on listener-a and listener-b.
|
static DisplayChangeListener |
remove(DisplayChangeListener l,
DisplayChangeListener oldl)
Removes the old DisplayChange-listener from DisplayChange-listener-l and
returns the resulting multicast listener.
|
actionPerformed, add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, addInternal, adjustmentValueChanged, ancestorMoved, ancestorResized, caretPositionChanged, componentAdded, componentHidden, componentMoved, componentRemoved, componentResized, componentShown, focusGained, focusLost, getListeners, hierarchyChanged, inputMethodTextChanged, itemStateChanged, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, removeInternal, save, saveInternal, textValueChanged, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowGainedFocus, windowIconified, windowLostFocus, windowOpened, windowStateChanged
public void displayChanged(DisplayChangeEvent e)
displayChanged
in interface DisplayChangeListener
e
- the DisplayChange eventpublic static DisplayChangeListener add(DisplayChangeListener a, DisplayChangeListener b)
a
- DisplayChange-listener-ab
- DisplayChange-listener-bpublic static DisplayChangeListener remove(DisplayChangeListener l, DisplayChangeListener oldl)
l
- DisplayChange-listener-loldl
- the DisplayChange-listener being removedCopyright © 2015–2021 Fiji. All rights reserved.