Warnings Fixed
This commit is contained in:
parent
85491f9f30
commit
d33ab0043a
@ -26,44 +26,40 @@ public class Listener implements ActionListener, KeyListener {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
switch (type){
|
switch (type) {
|
||||||
case "Help":
|
case "Help" -> frame.newHelp();
|
||||||
frame.newHelp();
|
case "Tab" -> frame.newTab();
|
||||||
break;
|
case "Clear" -> {
|
||||||
case "Tab":
|
|
||||||
frame.newTab();
|
|
||||||
break;
|
|
||||||
case "Clear":
|
|
||||||
frame.textAreaList.get(index).setText("Axiome : \n");
|
frame.textAreaList.get(index).setText("Axiome : \n");
|
||||||
frame.textAreaList.get(index+10).setText("Règles : \n");
|
frame.textAreaList.get(index + 10).setText("Règles : \n");
|
||||||
frame.textFieldList.get(index).setText("");
|
frame.textFieldList.get(index).setText("");
|
||||||
frame.textFieldList.get(index+10).setText("");
|
frame.textFieldList.get(index + 10).setText("");
|
||||||
break;
|
|
||||||
case "Generate":
|
|
||||||
String axiom = frame.getAxiom(index);
|
|
||||||
List<String> rules = frame.getRules(index+10);
|
|
||||||
Parser parser = new Parser(axiom,rules,12);
|
|
||||||
if(!parser.isCorrect()) {
|
|
||||||
JOptionPane.showMessageDialog(null, "Vos règles ou votre axiome ne sont pas correctement écrites, veuillez recommencer");
|
|
||||||
new Listener(frame,index,"Clear");
|
|
||||||
}
|
}
|
||||||
else{
|
case "Generate" -> {
|
||||||
|
String axiom = frame.getAxiom(index);
|
||||||
|
List<String> rules = frame.getRules(index + 10);
|
||||||
|
Parser parser = new Parser(axiom, rules, 12);
|
||||||
|
if (!parser.isCorrect()) {
|
||||||
|
JOptionPane.showMessageDialog(null, "Vos règles ou votre axiome ne sont pas correctement écrites, veuillez recommencer");
|
||||||
|
new Listener(frame, index, "Clear");
|
||||||
|
} else {
|
||||||
Rewrite rewriter = new Rewrite(axiom, parser.parseRules(), 12);
|
Rewrite rewriter = new Rewrite(axiom, parser.parseRules(), 12);
|
||||||
final String word = rewriter.rewrite();
|
final String word = rewriter.rewrite();
|
||||||
System.out.println(word);
|
System.out.println(word);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void keyTyped(KeyEvent ke) {
|
public void keyTyped(KeyEvent ke) {
|
||||||
if(nbAxioms==0 && ke.getKeyChar() !='\b')
|
if(nbAxioms==0 && ke.getKeyChar() !='\b')
|
||||||
frame.changeList(String.valueOf(ke.getKeyChar()), (JTextArea) frame.textAreaList.get(index),nbAxioms);
|
frame.changeList(String.valueOf(ke.getKeyChar()), frame.textAreaList.get(index),nbAxioms);
|
||||||
if(ke.getKeyChar() == '\b'){
|
if(ke.getKeyChar() == '\b'){
|
||||||
String str = frame.textAreaList.get(index).getText();
|
String str = frame.textAreaList.get(index).getText();
|
||||||
if(str.length()>11) {
|
if(str.length()>11) {
|
||||||
str = str.substring(10, str.length() - 1);
|
str = str.substring(10, str.length() - 1);
|
||||||
System.out.println(str.substring(str.length() - 1, str.length()));
|
frame.textAreaList.get(index).setText(type + " : \n" + str);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
frame.textAreaList.get(index).setText(type+" : \n");
|
frame.textAreaList.get(index).setText(type+" : \n");
|
||||||
@ -76,8 +72,8 @@ public class Listener implements ActionListener, KeyListener {
|
|||||||
if(ke.getKeyCode() == KeyEvent.VK_ENTER) {
|
if(ke.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||||
frame.textFieldList.get(index).setText(null);
|
frame.textFieldList.get(index).setText(null);
|
||||||
String str = ";";
|
String str = ";";
|
||||||
frame.changeList(str, (JTextArea) frame.textAreaList.get(index),nbAxioms);
|
frame.changeList(str, frame.textAreaList.get(index),nbAxioms);
|
||||||
if(type == "Axiome")
|
if(type.equals("Axiome"))
|
||||||
nbAxioms ++;
|
nbAxioms ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user