From 85491f9f30f93511d2fdede3a4edb2519d26895e Mon Sep 17 00:00:00 2001 From: Arthur <78031901+Arthur7770@users.noreply.github.com> Date: Wed, 17 Feb 2021 15:43:38 +0100 Subject: [PATCH] Erase get's more precise --- src/lsystem/screen/listener/Listener.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lsystem/screen/listener/Listener.java b/src/lsystem/screen/listener/Listener.java index 73ec7b4..7b3e6ce 100644 --- a/src/lsystem/screen/listener/Listener.java +++ b/src/lsystem/screen/listener/Listener.java @@ -61,8 +61,12 @@ public class Listener implements ActionListener, KeyListener { frame.changeList(String.valueOf(ke.getKeyChar()), (JTextArea) frame.textAreaList.get(index),nbAxioms); if(ke.getKeyChar() == '\b'){ String str = frame.textAreaList.get(index).getText(); - str = str.substring(10,str.length()-1); - frame.textAreaList.get(index).setText(type+" : \n"+str); + if(str.length()>11) { + str = str.substring(10, str.length() - 1); + System.out.println(str.substring(str.length() - 1, str.length())); + } + else + frame.textAreaList.get(index).setText(type+" : \n"); } }