com.terminaldriver.tn5250j.obj.KeyStrokes Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of terminaldriver-tn5250j Show documentation
Show all versions of terminaldriver-tn5250j Show documentation
terminal driver for 5250 telnet
package com.terminaldriver.tn5250j.obj;
import com.terminaldriver.tn5250j.TerminalDriver;
import com.terminaldriver.tn5250j.exceptions.InvalidKeyException;
public class KeyStrokes {
TerminalDriver driver;
public KeyStrokes(final TerminalDriver driver) {
super();
this.driver = driver;
}
public KeyStrokes press(final Key key) {
driver.sendKeys(key.toString());
return this;
}
public KeyStrokes enter() {
press(Key.ENTER);
return this;
}
public KeyStrokes fieldExit() {
press(Key.FIELD_EXIT);
return this;
}
public KeyStrokes f3() {
command(3);
return this;
}
public KeyStrokes command(final int keyCommand) {
if (keyCommand < 1 || keyCommand > 24) {
throw new InvalidKeyException("Command key " + keyCommand + " invalid.");
}
driver.getSession().getScreen().sendKeys("[PF" + String.valueOf(keyCommand) + "]");
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy