From 97925fd331a19edef25a99a25232bd56bc535496 Mon Sep 17 00:00:00 2001 From: Arthur <78031901+Arthur7770@users.noreply.github.com> Date: Tue, 13 Apr 2021 16:14:11 +0200 Subject: [PATCH] Test --- src/lsystem/screen/main/Listener.java | 5 +++-- src/lsystem/screen/main/Tab.java | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/lsystem/screen/main/Listener.java b/src/lsystem/screen/main/Listener.java index d10f731..adbc544 100644 --- a/src/lsystem/screen/main/Listener.java +++ b/src/lsystem/screen/main/Listener.java @@ -25,6 +25,7 @@ public class Listener implements ActionListener, KeyListener, MouseWheelListener this.frame = frame; this.index = index; this.type = type; + System.getProperty("os.name"); } @Override @@ -149,9 +150,9 @@ public class Listener implements ActionListener, KeyListener, MouseWheelListener byte i = (byte) ((type.equals("Axiome")) ? 0 : 1); - if(nbAxioms==0 && ke.getKeyCode() != KeyEvent.VK_BACK_SPACE) + if(nbAxioms==0 && ke.getKeyChar() != '\b') tab.changeList(String.valueOf(ke.getKeyChar()), tab.getTextArea(i),nbAxioms); - if(ke.getKeyCode() == KeyEvent.VK_BACK_SPACE){ + if(ke.getKeyChar() == '\b'){ String str = tab.getTextArea(i).getText(); if(str.length()>10) { if (!(str.endsWith(";\n") || str.endsWith(";"))){ diff --git a/src/lsystem/screen/main/Tab.java b/src/lsystem/screen/main/Tab.java index c1e4443..dd93818 100644 --- a/src/lsystem/screen/main/Tab.java +++ b/src/lsystem/screen/main/Tab.java @@ -19,6 +19,8 @@ public class Tab extends JPanel{ this.nbRules = nbRules; this.nbTabs = nbTabs; + this.add(new JButton("Close")); + axiomList = textArea("Axiome : \n",nbTabs); rulesList = textArea("Règles : \n",nbTabs+10); @@ -70,10 +72,6 @@ public class Tab extends JPanel{ this.add(aboveComponents); this.add(southComponents2); this.setLayout(new BoxLayout(this,1)); - this.add(new JButton("Close")); - - - tabs.addTab("Génération"+String.valueOf(nbTabs),this); }