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

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