From 11529aaf18b4c790243fa92567a79bff1772b96c Mon Sep 17 00:00:00 2001 From: Arthur <78031901+Arthur7770@users.noreply.github.com> Date: Mon, 19 Apr 2021 11:26:15 +0200 Subject: [PATCH] Fixed TextField --- src/lsystem/screen/main/Listener.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lsystem/screen/main/Listener.java b/src/lsystem/screen/main/Listener.java index 2ad5f5c..f261ca5 100644 --- a/src/lsystem/screen/main/Listener.java +++ b/src/lsystem/screen/main/Listener.java @@ -77,9 +77,9 @@ public class Listener implements ActionListener, KeyListener, MouseWheelListener @Override public void keyPressed(KeyEvent ke) { + byte i = (byte) ((type.equals("Axiome")) ? 0 : 1); + if(ke.getKeyCode() == KeyEvent.VK_ENTER && tab.getTextField(i).getText().length() > 0){ - if(ke.getKeyCode() == KeyEvent.VK_ENTER) { - byte i = (byte) ((type.equals("Axiome")) ? 0 : 1); String text = tab.getTextField(i).getText(); text = ((text.charAt(text.length()-1)==';') ? "\n"+text : "\n"+text+";"); tab.getTextField(i).setText(null);