Add loading-gif.gif to generate JButton
This commit is contained in:
parent
852004a609
commit
0dd3552126
@ -2,6 +2,7 @@
|
|||||||
<property name="project.sources.dir" value="src"/>
|
<property name="project.sources.dir" value="src"/>
|
||||||
<property name="project.bin.dir" value="bin"/>
|
<property name="project.bin.dir" value="bin"/>
|
||||||
<property name="project.lib.dir" value="lib"/>
|
<property name="project.lib.dir" value="lib"/>
|
||||||
|
<property name="project.resources.dir" value="resources"/>
|
||||||
<path id="project.classpath">
|
<path id="project.classpath">
|
||||||
<fileset dir="${project.lib.dir}">
|
<fileset dir="${project.lib.dir}">
|
||||||
<include name="*/*.jar"/>
|
<include name="*/*.jar"/>
|
||||||
@ -12,10 +13,15 @@
|
|||||||
<javac srcdir="${project.sources.dir}" destdir="${project.bin.dir}" debug="on" optimize="off" deprecation="on" includeantruntime="false">
|
<javac srcdir="${project.sources.dir}" destdir="${project.bin.dir}" debug="on" optimize="off" deprecation="on" includeantruntime="false">
|
||||||
<classpath refid="project.classpath"/>
|
<classpath refid="project.classpath"/>
|
||||||
</javac>
|
</javac>
|
||||||
|
<copy todir="${basedir}/${project.bin.dir}">
|
||||||
|
<fileset dir="${basedir}/${project.resources.dir}">
|
||||||
|
<exclude name="**/*.java"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
<target name="init">
|
<target name="init">
|
||||||
<echo message="Initialisation de ${ant.project.name}"/>
|
<echo message="Initialisation de ${ant.project.name}"/>
|
||||||
<mkdir dir="${basedir}/bin"/>
|
<mkdir dir="${basedir}/${project.bin.dir}"/>
|
||||||
</target>
|
</target>
|
||||||
<target name="run" description="execution" depends="compile">
|
<target name="run" description="execution" depends="compile">
|
||||||
<java classname="lsystem.Main" fork="true">
|
<java classname="lsystem.Main" fork="true">
|
||||||
|
BIN
resources/loading-gif.gif
Normal file
BIN
resources/loading-gif.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
@ -2,7 +2,6 @@ package lsystem.screen.gl3d;
|
|||||||
|
|
||||||
import com.jogamp.opengl.GL2;
|
import com.jogamp.opengl.GL2;
|
||||||
import com.jogamp.opengl.util.gl2.GLUT;
|
import com.jogamp.opengl.util.gl2.GLUT;
|
||||||
|
|
||||||
import lsystem.screen.gl2d.Point2;
|
import lsystem.screen.gl2d.Point2;
|
||||||
import lsystem.screen.gl2d.SwingGLCanvas2D;
|
import lsystem.screen.gl2d.SwingGLCanvas2D;
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import lsystem.engine.Parser;
|
|||||||
import lsystem.screen.AbstractCanvas;
|
import lsystem.screen.AbstractCanvas;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
@ -18,6 +19,8 @@ public class Listener implements ActionListener, KeyListener {
|
|||||||
String type;
|
String type;
|
||||||
Integer nbAxioms;
|
Integer nbAxioms;
|
||||||
Thread parserThread = null;
|
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){
|
public Listener(MainFrame frame, Integer index, String type, Tab tab){
|
||||||
this.tab = tab;
|
this.tab = tab;
|
||||||
@ -58,6 +61,8 @@ public class Listener implements ActionListener, KeyListener {
|
|||||||
} else if (!parser.isCorrect()) {
|
} else if (!parser.isCorrect()) {
|
||||||
openDialog("Vos règles ou votre axiome ne sont pas correctement écrites, veuillez recommencer");
|
openDialog("Vos règles ou votre axiome ne sont pas correctement écrites, veuillez recommencer");
|
||||||
} else {
|
} else {
|
||||||
|
tab.submitButton.setIcon(staticIcon);
|
||||||
|
tab.submitButton.setText("");
|
||||||
parserThread = new Thread(() -> {
|
parserThread = new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
Main.joglFrame.setLSystem(axiom, parser.parseRules(), tab.getNbIterations());
|
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;
|
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());
|
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();
|
parserThread.start();
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ public class Tab extends JPanel{
|
|||||||
JTextArea axiomList;
|
JTextArea axiomList;
|
||||||
JTextArea rulesList;
|
JTextArea rulesList;
|
||||||
JSpinner itSpinner;
|
JSpinner itSpinner;
|
||||||
|
JButton submitButton;
|
||||||
|
|
||||||
public Tab(int nbTabs,int nbRules,JTabbedPane tabs) {
|
public Tab(int nbTabs,int nbRules,JTabbedPane tabs) {
|
||||||
this.nbRules = nbRules;
|
this.nbRules = nbRules;
|
||||||
@ -42,7 +43,7 @@ public class Tab extends JPanel{
|
|||||||
rulesField.addKeyListener(new Listener(null,nbTabs+10,"Règles",this));
|
rulesField.addKeyListener(new Listener(null,nbTabs+10,"Règles",this));
|
||||||
rulesField.setPreferredSize(new Dimension(120,20));
|
rulesField.setPreferredSize(new Dimension(120,20));
|
||||||
|
|
||||||
JButton submitButton = new JButton("Générer");
|
submitButton = new JButton("Générer");
|
||||||
JButton clearButton = new JButton("Clear");
|
JButton clearButton = new JButton("Clear");
|
||||||
clearButton.addActionListener(new Listener(null,nbTabs,"Clear",this));
|
clearButton.addActionListener(new Listener(null,nbTabs,"Clear",this));
|
||||||
submitButton.addActionListener(new Listener(null,nbTabs,"Generate",this));
|
submitButton.addActionListener(new Listener(null,nbTabs,"Generate",this));
|
||||||
|
Loading…
Reference in New Issue
Block a user