Adding internationalizing classes, with french, english, spanish and default local. Adding Icon
This commit is contained in:
parent
82847fd740
commit
48d8d3a411
@ -0,0 +1,39 @@
|
|||||||
|
package fr.uha.gabalier.util.languages;
|
||||||
|
|
||||||
|
import java.beans.Beans;
|
||||||
|
import java.util.MissingResourceException;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
public class StringSources {
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Constructor
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
private StringSources() {
|
||||||
|
// do not instantiate
|
||||||
|
}
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Bundle access
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
private static final String BUNDLE_NAME = "fr.uha.gabalier.util.languages.stringsources"; //$NON-NLS-1$
|
||||||
|
private static final ResourceBundle RESOURCE_BUNDLE = loadBundle();
|
||||||
|
private static ResourceBundle loadBundle() {
|
||||||
|
return ResourceBundle.getBundle(BUNDLE_NAME);
|
||||||
|
}
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Strings access
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
public static String getString(String key) {
|
||||||
|
try {
|
||||||
|
ResourceBundle bundle = Beans.isDesignTime() ? loadBundle() : RESOURCE_BUNDLE;
|
||||||
|
return bundle.getString(key);
|
||||||
|
} catch (MissingResourceException e) {
|
||||||
|
return "!" + key + "!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
#Eclipse messages class
|
||||||
|
#Thu Sep 27 17:27:39 CEST 2018
|
||||||
|
Preview.cancelItem.text=Cancel
|
||||||
|
Preview.exitItem.text=Exit
|
||||||
|
Preview.fileMenu.text=File
|
||||||
|
Preview.loadItem.text=Load
|
||||||
|
Preview.other.text=status \:
|
||||||
|
Preview.statusText.text=0000 images loaded
|
||||||
|
Preview.this.title=Image Loader
|
@ -0,0 +1,9 @@
|
|||||||
|
#Eclipse messages class
|
||||||
|
#Thu Sep 27 17:27:39 CEST 2018
|
||||||
|
Preview.cancelItem.text=Cancel
|
||||||
|
Preview.exitItem.text=Exit
|
||||||
|
Preview.fileMenu.text=File
|
||||||
|
Preview.loadItem.text=Load
|
||||||
|
Preview.other.text=status \:
|
||||||
|
Preview.statusText.text=0000 images loaded
|
||||||
|
Preview.this.title=Image Loader
|
@ -0,0 +1,9 @@
|
|||||||
|
#Eclipse messages class
|
||||||
|
#Thu Sep 27 17:27:40 CEST 2018
|
||||||
|
Preview.cancelItem.text=Cancelar
|
||||||
|
Preview.exitItem.text=Salir
|
||||||
|
Preview.fileMenu.text=Archivo
|
||||||
|
Preview.loadItem.text=Carga
|
||||||
|
Preview.other.text=Estatus \:
|
||||||
|
Preview.statusText.text=0000 im\u00E1genes cargadas
|
||||||
|
Preview.this.title=Cargador de im\u00E1genes
|
@ -0,0 +1,9 @@
|
|||||||
|
#Eclipse messages class
|
||||||
|
#Thu Sep 27 17:27:39 CEST 2018
|
||||||
|
Preview.cancelItem.text=Annuler
|
||||||
|
Preview.exitItem.text=Quitter
|
||||||
|
Preview.fileMenu.text=Fichier
|
||||||
|
Preview.loadItem.text=Charger
|
||||||
|
Preview.other.text=Status \:
|
||||||
|
Preview.statusText.text=0000 images charg\u00E9es
|
||||||
|
Preview.this.title=Visionneuse d'image
|
BIN
src/main/java/fr/uha/gabalier/util/ressources/logo.jpg
Normal file
BIN
src/main/java/fr/uha/gabalier/util/ressources/logo.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
@ -9,6 +9,7 @@ import java.awt.event.InputEvent;
|
|||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import fr.uha.gabalier.util.languages.StringSources;
|
||||||
|
|
||||||
public class Preview extends JFrame {
|
public class Preview extends JFrame {
|
||||||
|
|
||||||
@ -33,6 +34,8 @@ public class Preview extends JFrame {
|
|||||||
private final JTextField statusText;
|
private final JTextField statusText;
|
||||||
|
|
||||||
public Preview() throws HeadlessException {
|
public Preview() throws HeadlessException {
|
||||||
|
setIconImage(Toolkit.getDefaultToolkit().getImage(Preview.class.getResource("/fr/uha/gabalier/util/ressources/logo.jpg")));
|
||||||
|
setTitle(StringSources.getString("Preview.this.title")); //$NON-NLS-1$
|
||||||
model = new ArrayList<>();
|
model = new ArrayList<>();
|
||||||
|
|
||||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
@ -40,21 +43,21 @@ public class Preview extends JFrame {
|
|||||||
// UI elements
|
// UI elements
|
||||||
JMenuBar menuBar = new JMenuBar();
|
JMenuBar menuBar = new JMenuBar();
|
||||||
setJMenuBar(menuBar);
|
setJMenuBar(menuBar);
|
||||||
JMenu fileMenu = new JMenu("File");
|
JMenu fileMenu = new JMenu(StringSources.getString("Preview.fileMenu.text")); //$NON-NLS-1$
|
||||||
menuBar.add(fileMenu);
|
menuBar.add(fileMenu);
|
||||||
|
|
||||||
loadItem = new JMenuItem("Load");
|
loadItem = new JMenuItem(StringSources.getString("Preview.loadItem.text")); //$NON-NLS-1$
|
||||||
fileMenu.add(loadItem);
|
fileMenu.add(loadItem);
|
||||||
loadItem.addActionListener(actionEvent -> doLoad());
|
loadItem.addActionListener(actionEvent -> doLoad());
|
||||||
cancelItem = new JMenuItem("Cancel");
|
cancelItem = new JMenuItem(StringSources.getString("Preview.cancelItem.text")); //$NON-NLS-1$
|
||||||
fileMenu.add(cancelItem);
|
fileMenu.add(cancelItem);
|
||||||
cancelItem.addActionListener(actionEvent -> doCancel());
|
cancelItem.addActionListener(actionEvent -> doCancel());
|
||||||
final JMenuItem exitItem = new JMenuItem("Exit");
|
final JMenuItem exitItem = new JMenuItem(StringSources.getString("Preview.exitItem.text")); //$NON-NLS-1$
|
||||||
exitItem.addActionListener(actionEvent -> doExit());
|
exitItem.addActionListener(actionEvent -> doExit());
|
||||||
exitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.CTRL_DOWN_MASK));
|
exitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.CTRL_DOWN_MASK));
|
||||||
fileMenu.add(exitItem);
|
fileMenu.add(exitItem);
|
||||||
|
|
||||||
setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
|
getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
|
||||||
|
|
||||||
imageView = new ImageView(model);
|
imageView = new ImageView(model);
|
||||||
final ImageController controller = new ImageController(model);
|
final ImageController controller = new ImageController(model);
|
||||||
@ -73,8 +76,8 @@ public class Preview extends JFrame {
|
|||||||
|
|
||||||
final JPanel statusPanel = new JPanel();
|
final JPanel statusPanel = new JPanel();
|
||||||
getContentPane().add(statusPanel);
|
getContentPane().add(statusPanel);
|
||||||
statusText = new JTextField("0000 images loaded");
|
statusText = new JTextField(StringSources.getString("Preview.statusText.text")); //$NON-NLS-1$
|
||||||
statusPanel.add(new JLabel("status :"));
|
statusPanel.add(new JLabel(StringSources.getString("Preview.other.text"))); //$NON-NLS-1$
|
||||||
statusPanel.add(statusText);
|
statusPanel.add(statusText);
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
|
Loading…
Reference in New Issue
Block a user