actions en français

bouton quitter
This commit is contained in:
philippe lhardy
2017-11-18 21:01:06 +01:00
parent 8f234bb41b
commit 65b9fb31dd
3 changed files with 44 additions and 14 deletions

View File

@@ -32,6 +32,7 @@
<manifest> <manifest>
<attribute name="Main-Class" value="org.artisanlogiciel.games.Display"/> <attribute name="Main-Class" value="org.artisanlogiciel.games.Display"/>
</manifest> </manifest>
<fileset dir="lang" includes="**" />
</jar> </jar>
</target> </target>

View File

@@ -5,6 +5,7 @@ import java.awt.image.BufferedImage;
import java.awt.Color; import java.awt.Color;
import java.awt.Container; import java.awt.Container;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@@ -16,7 +17,9 @@ import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Locale;
import java.util.Scanner; import java.util.Scanner;
import java.util.ResourceBundle;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@@ -36,6 +39,7 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import org.artisanlogiciel.games.stl.Wall3d; import org.artisanlogiciel.games.stl.Wall3d;
import org.artisanlogiciel.util.UTF8Control;
/** /**
* Display is Main JFrame for this tool * Display is Main JFrame for this tool
@@ -45,6 +49,8 @@ public class Display extends JFrame
// to please eclipse, not supposed to be serialized // to please eclipse, not supposed to be serialized
private static final long serialVersionUID = 8500214871372184418L; private static final long serialVersionUID = 8500214871372184418L;
final static ResourceBundle labels = ResourceBundle.getBundle("LabelsBundle", Locale.FRENCH, Display.class.getClassLoader(), new UTF8Control());
MazeComponent maze; MazeComponent maze;
MazeControler controler; MazeControler controler;
LabyModel model; LabyModel model;
@@ -181,7 +187,7 @@ public class Display extends JFrame
void createSettingsGui() void createSettingsGui()
{ {
JButton buttonCreate = new JButton("Create"); JButton buttonCreate = new JButton(labels.getString("create"));
buttonCreate.addActionListener(new ActionListener() buttonCreate.addActionListener(new ActionListener()
{ {
public void actionPerformed(ActionEvent evt) public void actionPerformed(ActionEvent evt)
@@ -192,15 +198,15 @@ public class Display extends JFrame
add(buttonCreate); add(buttonCreate);
if ( params != null ) if ( params != null )
{ {
JLabel widthLabel = new JLabel("width"); JLabel widthLabel = new JLabel(labels.getString("width"));
textWidth = new JTextField("0" + params.getWidth()); textWidth = new JTextField("0" + params.getWidth());
add(widthLabel); add(widthLabel);
add(textWidth); add(textWidth);
JLabel heightLabel = new JLabel("height"); JLabel heightLabel = new JLabel(labels.getString("height"));
textHeight = new JTextField("0" + params.getHeight()); textHeight = new JTextField("0" + params.getHeight());
add(heightLabel); add(heightLabel);
add(textHeight); add(textHeight);
JLabel depthLabel = new JLabel("depth"); JLabel depthLabel = new JLabel(labels.getString("depth"));
textDepth = new JTextField("0" + params.getMaxDepth()); textDepth = new JTextField("0" + params.getMaxDepth());
add(depthLabel); add(depthLabel);
add(textDepth); add(textDepth);
@@ -295,7 +301,7 @@ public class Display extends JFrame
super(new BorderLayout()); super(new BorderLayout());
controlPanel = new JPanel(new BorderLayout()); controlPanel = new JPanel(new BorderLayout());
settings = new MazeSettings(params); settings = new MazeSettings(params);
JButton button = new JButton("Resolve"); JButton button = new JButton(labels.getString("resolve"));
button.addActionListener(new ActionListener() button.addActionListener(new ActionListener()
{ {
public void actionPerformed(ActionEvent evt) public void actionPerformed(ActionEvent evt)
@@ -316,7 +322,7 @@ public class Display extends JFrame
goNorth(); goNorth();
} }
}; };
JButton north = addDirection(this, "North", "UP", goNorth); JButton north = addDirection(this, labels.getString("north"), "UP", goNorth);
@SuppressWarnings("serial") @SuppressWarnings("serial")
Action goEast = new AbstractAction() Action goEast = new AbstractAction()
@@ -329,7 +335,7 @@ public class Display extends JFrame
} }
}; };
JButton east = addDirection(this, "East", "RIGHT", goEast); JButton east = addDirection(this, labels.getString("east"), "RIGHT", goEast);
@SuppressWarnings("serial") @SuppressWarnings("serial")
Action goWest = new AbstractAction() Action goWest = new AbstractAction()
@@ -341,7 +347,7 @@ public class Display extends JFrame
goWest(); goWest();
} }
}; };
JButton west = addDirection(this, "West", "LEFT", goWest); JButton west = addDirection(this, labels.getString("west"), "LEFT", goWest);
@SuppressWarnings("serial") @SuppressWarnings("serial")
Action goSouth = new AbstractAction() Action goSouth = new AbstractAction()
@@ -353,7 +359,7 @@ public class Display extends JFrame
goSouth(); goSouth();
} }
}; };
JButton south = addDirection(this, "South", "DOWN", goSouth); JButton south = addDirection(this, labels.getString("south"), "DOWN", goSouth);
controlPanel.add(button, BorderLayout.CENTER); controlPanel.add(button, BorderLayout.CENTER);
controlPanel.add(north, BorderLayout.NORTH); controlPanel.add(north, BorderLayout.NORTH);
@@ -381,7 +387,7 @@ public class Display extends JFrame
setAutoSize( autoSlide.isSelected()); setAutoSize( autoSlide.isSelected());
} }
}); });
final JButton savePngButton = new JButton("Save png"); final JButton savePngButton = new JButton(labels.getString("save") +" png");
Action savePngAction = new AbstractAction() { Action savePngAction = new AbstractAction() {
public void actionPerformed(ActionEvent evt) public void actionPerformed(ActionEvent evt)
{ {
@@ -392,10 +398,22 @@ public class Display extends JFrame
}; };
savePngButton.addActionListener(savePngAction); savePngButton.addActionListener(savePngAction);
resizecontrol = new JPanel(); final JButton quitButton = new JButton(labels.getString("quit"));
resizecontrol.add(slider, BorderLayout.WEST); Action quitAction = new AbstractAction() {
resizecontrol.add(autoSlide, BorderLayout.EAST); public void actionPerformed(ActionEvent evt)
resizecontrol.add(savePngButton, BorderLayout.SOUTH); {
//
System.out.println("quit");
System.exit(0);
}
};
quitButton.addActionListener(quitAction);
resizecontrol = new JPanel(new FlowLayout());
resizecontrol.add(slider);
resizecontrol.add(autoSlide);
resizecontrol.add(savePngButton);
resizecontrol.add(quitButton);
add(controlDisplayPanel, BorderLayout.SOUTH); add(controlDisplayPanel, BorderLayout.SOUTH);
add(resizecontrol,BorderLayout.WEST); add(resizecontrol,BorderLayout.WEST);

View File

@@ -0,0 +1,11 @@
width = largeur
height = hauteur
depth = profondeur
north = nord
south = sud
east = est
west = ouest
resolve = résoudre
create = créer
save = sauver
quit = quitter