commit - cfdc726513c95b22b71d9907fc23ae0f7fb77ece
commit + 3f722edaa3dd0dfeff64ef280d5bf587cfe645b7
blob - c1f0734beaf8a5911f1508436d16774cc858a9dd
blob + c88b0ff2bbf3f693b574fa4b2b8518ab75a0aa62
--- de/mud/terminal/SwingTerminal.java
+++ de/mud/terminal/SwingTerminal.java
/** the VDU buffer */
private VDUBuffer buffer;
+
+ /** the VDU input handler */
+ private VDUInput input;
/** lightweight component definitions */
private final static long VDU_EVENTS = AWTEvent.KEY_EVENT_MASK
this.buffer = buffer;
buffer.setDisplay(this);
}
+
+ /**
+ * Set a new terminal (VDU) input handler.
+ * @param input new input handler
+ */
+ public void setVDUInput(VDUInput input) {
+ this.input = input;
+ }
/**
* Return the currently associated VDUBuffer.
}
/**
+ * Return the currently associated VDUInput.
+ * @return the current input handler
+ */
+ public VDUInput getVDUInput() {
+ return input;
+ }
+
+ /**
* Set new color set for the display.
* @param colorset new color set
*/
int xoffset = (super.getSize().width - buffer.width * charWidth) / 2;
int yoffset = (super.getSize().height - buffer.height * charHeight) / 2;
- if (buffer instanceof VDUInput) {
- ((VDUInput) buffer).mousePressed(xoffset, yoffset, evt.getModifiers());
+ if (input != null) {
+ input.mousePressed(xoffset, yoffset, evt.getModifiers());
}
// looks like we get no modifiers here ... ... We do? -Marcus
int xoffset = (super.getSize().width - buffer.width * charWidth) / 2;
int yoffset = (super.getSize().height - buffer.height * charHeight) / 2;
- if (buffer instanceof VDUInput) {
- ((VDUInput) buffer).mousePressed(xoffset, yoffset, evt.getModifiers());
+ if (input != null) {
+ input.mousePressed(xoffset, yoffset, evt.getModifiers());
}
if (buttonCheck(evt.getModifiers(), MouseEvent.BUTTON1_MASK)) {
}
public void keyTyped(KeyEvent e) {
- if (buffer != null && buffer instanceof VDUInput)
- ((VDUInput) buffer).keyTyped(e.getKeyCode(), e.getKeyChar(), getModifiers(e));
+ if (input != null)
+ input.keyTyped(e.getKeyCode(), e.getKeyChar(), getModifiers(e));
}
public void keyPressed(KeyEvent e) {
- if (buffer != null && buffer instanceof VDUInput)
- ((VDUInput) buffer).keyPressed(e.getKeyCode(), e.getKeyChar(), getModifiers(e));
+ if (input != null)
+ input.keyPressed(e.getKeyCode(), e.getKeyChar(), getModifiers(e));
}
public void keyReleased(KeyEvent e) {