Ignore whitespace in port input field.

This commit is contained in:
Peter Osterlund 2019-05-23 06:22:09 +02:00
parent b69af245e6
commit f534754f10

View File

@ -142,7 +142,7 @@ public class MainWindow {
}); });
port[r].addFocusListener(new FocusAdapter() { port[r].addFocusListener(new FocusAdapter() {
@Override @Override
public void focusLost(FocusEvent focusEvent) { public void focusLost(FocusEvent event) {
portChanged(engineNo); portChanged(engineNo);
} }
}); });
@ -164,7 +164,7 @@ public class MainWindow {
}); });
filename[r].addFocusListener(new FocusAdapter() { filename[r].addFocusListener(new FocusAdapter() {
@Override @Override
public void focusLost(FocusEvent focusEvent) { public void focusLost(FocusEvent event) {
filenameChanged(engineNo); filenameChanged(engineNo);
} }
}); });
@ -186,7 +186,7 @@ public class MainWindow {
}); });
arguments[r].addFocusListener(new FocusAdapter() { arguments[r].addFocusListener(new FocusAdapter() {
@Override @Override
public void focusLost(FocusEvent focusEvent) { public void focusLost(FocusEvent event) {
argumentsChanged(engineNo); argumentsChanged(engineNo);
} }
}); });
@ -226,7 +226,7 @@ public class MainWindow {
private void portChanged(int engineNo) { private void portChanged(int engineNo) {
EngineConfig config = configs[engineNo]; EngineConfig config = configs[engineNo];
try { try {
int p = Integer.valueOf(port[engineNo].getText()); int p = Integer.valueOf(port[engineNo].getText().trim());
if (p >= 1024 && p < 65536 && p != config.port) { if (p >= 1024 && p < 65536 && p != config.port) {
config.port = p; config.port = p;
server.configChanged(engineNo); server.configChanged(engineNo);