My class does an ouput (with System.out.println()
) and the other class should take this output as an input (with Scanner
scan.hasNextInt()
, and scan.nextInt()
).
Do you know, how my Scanner
recognize this output as an input? (As I cannot press enter afterwards or something.)
@Override
public void actionPerformed(ActionEvent e) {
System.out.println(e.getActionCommand());
}
So this does the output (its Buttons... the Action Command are the coordinates x + y. This should takes the output as an input:
if(scan.hasNextInt()) {
x = scan.nextInt();
if(x < 0 || x >= this.length) {
System.out.println("Falsche Eingabe! Nochmal!");
count--; return;
}
}