diff --git a/build.xml b/build.xml index 31f62d8..635a838 100644 --- a/build.xml +++ b/build.xml @@ -2,6 +2,7 @@ + @@ -12,10 +13,15 @@ + + + + + - + diff --git a/resources/loading-gif.gif b/resources/loading-gif.gif new file mode 100644 index 0000000..e06ffc1 Binary files /dev/null and b/resources/loading-gif.gif differ diff --git a/src/lsystem/screen/gl3d/DrawHelper.java b/src/lsystem/screen/gl3d/DrawHelper.java index 4110ee0..840525b 100644 --- a/src/lsystem/screen/gl3d/DrawHelper.java +++ b/src/lsystem/screen/gl3d/DrawHelper.java @@ -2,7 +2,6 @@ package lsystem.screen.gl3d; import com.jogamp.opengl.GL2; import com.jogamp.opengl.util.gl2.GLUT; - import lsystem.screen.gl2d.Point2; import lsystem.screen.gl2d.SwingGLCanvas2D; diff --git a/src/lsystem/screen/main/Listener.java b/src/lsystem/screen/main/Listener.java index d37e9a4..cde62d9 100644 --- a/src/lsystem/screen/main/Listener.java +++ b/src/lsystem/screen/main/Listener.java @@ -5,6 +5,7 @@ import lsystem.engine.Parser; import lsystem.screen.AbstractCanvas; import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; @@ -18,6 +19,8 @@ public class Listener implements ActionListener, KeyListener { String type; Integer nbAxioms; Thread parserThread = null; + ImageIcon staticIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getClassLoader().getResource("loading-gif.gif"))); + public Listener(MainFrame frame, Integer index, String type, Tab tab){ this.tab = tab; @@ -58,6 +61,8 @@ public class Listener implements ActionListener, KeyListener { } else if (!parser.isCorrect()) { openDialog("Vos règles ou votre axiome ne sont pas correctement écrites, veuillez recommencer"); } else { + tab.submitButton.setIcon(staticIcon); + tab.submitButton.setText(""); parserThread = new Thread(() -> { try { Main.joglFrame.setLSystem(axiom, parser.parseRules(), tab.getNbIterations()); @@ -66,6 +71,8 @@ public class Listener implements ActionListener, KeyListener { Main.joglFrame.parsedState = AbstractCanvas.State.FINISH_OR_NULL; openDialog("Une erreur de type " + err.getClass().getSimpleName() + " est survenue lors de l'execution du parser: " + err.getMessage()); } + tab.submitButton.setIcon(null); + tab.submitButton.setText("Générer"); }); parserThread.start(); } diff --git a/src/lsystem/screen/main/Tab.java b/src/lsystem/screen/main/Tab.java index 2a5100e..bb58e33 100644 --- a/src/lsystem/screen/main/Tab.java +++ b/src/lsystem/screen/main/Tab.java @@ -14,6 +14,7 @@ public class Tab extends JPanel{ JTextArea axiomList; JTextArea rulesList; JSpinner itSpinner; + JButton submitButton; public Tab(int nbTabs,int nbRules,JTabbedPane tabs) { this.nbRules = nbRules; @@ -42,7 +43,7 @@ public class Tab extends JPanel{ rulesField.addKeyListener(new Listener(null,nbTabs+10,"Règles",this)); rulesField.setPreferredSize(new Dimension(120,20)); - JButton submitButton = new JButton("Générer"); + submitButton = new JButton("Générer"); JButton clearButton = new JButton("Clear"); clearButton.addActionListener(new Listener(null,nbTabs,"Clear",this)); submitButton.addActionListener(new Listener(null,nbTabs,"Generate",this));