We can now erase rules and axioms
This commit is contained in:
parent
a29f8f5ec3
commit
2139f3d7c3
@ -28,12 +28,12 @@ public class Tab {
|
||||
JLabel rules = new JLabel("Règle "+ nbRules+" :");
|
||||
|
||||
JTextField axiomeField = new JTextField();
|
||||
axiomeField.addKeyListener(new Listener(frame,nbTabs,"Axiom"));
|
||||
axiomeField.addKeyListener(new Listener(frame,nbTabs,"Axiome"));
|
||||
axiomeField.setPreferredSize(new Dimension(120,20));
|
||||
frame.addToTextFieldList(axiomeField,nbTabs);
|
||||
|
||||
JTextField rulesField = new JTextField();
|
||||
rulesField.addKeyListener(new Listener(frame,nbTabs+10,"Rules"));
|
||||
rulesField.addKeyListener(new Listener(frame,nbTabs+10,"Règles"));
|
||||
rulesField.setPreferredSize(new Dimension(120,20));
|
||||
frame.addToTextFieldList(rulesField,nbTabs+10);
|
||||
|
||||
|
@ -57,8 +57,14 @@ public class Listener implements ActionListener, KeyListener {
|
||||
}
|
||||
@Override
|
||||
public void keyTyped(KeyEvent ke) {
|
||||
if(ke.getKeyCode() != KeyEvent.VK_ENTER && nbAxioms==0)
|
||||
if(nbAxioms==0 && ke.getKeyChar() !='\b')
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -67,7 +73,7 @@ public class Listener implements ActionListener, KeyListener {
|
||||
frame.textFieldList.get(index).setText(null);
|
||||
String str = ";";
|
||||
frame.changeList(str, (JTextArea) frame.textAreaList.get(index),nbAxioms);
|
||||
if(type == "Axiom")
|
||||
if(type == "Axiome")
|
||||
nbAxioms ++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user