java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/Startér.java
branchv_0
changeset 15 984cba2864e5
parent 13 9c995a5aee2b
child 19 adea235f456a
     1.1 --- a/java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/Startér.java	Thu Dec 16 01:31:11 2010 +0100
     1.2 +++ b/java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/Startér.java	Tue Dec 28 17:02:08 2010 +0100
     1.3 @@ -8,6 +8,8 @@
     1.4  import java.awt.event.KeyEvent;
     1.5  import java.io.File;
     1.6  import java.io.IOException;
     1.7 +import java.text.MessageFormat;
     1.8 +import java.util.ResourceBundle;
     1.9  import java.util.logging.Level;
    1.10  import java.util.logging.Logger;
    1.11  import javax.swing.JComponent;
    1.12 @@ -30,6 +32,7 @@
    1.13  public class Startér {
    1.14  
    1.15  	private static final Logger log = Logger.getLogger(Startér.class.getSimpleName());
    1.16 +	private static final ResourceBundle překlady = ResourceBundle.getBundle("cz.frantovo.rozsireneAtributy.Překlady");
    1.17  
    1.18  	/**
    1.19  	 * @param args název souboru
    1.20 @@ -37,6 +40,7 @@
    1.21  	 */
    1.22  	public static void main(String[] args) throws IOException {
    1.23  
    1.24 +
    1.25  		if (args.length == 1 && args[0].length() > 0) {
    1.26  			File soubor = new File(args[0]);
    1.27  
    1.28 @@ -60,21 +64,21 @@
    1.29  				}, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
    1.30  
    1.31  				f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    1.32 -				f.setTitle("Rozšířené stributy souboru: " + soubor);
    1.33 +				f.setTitle(MessageFormat.format(překlady.getString("titulek"), soubor));
    1.34  				f.setSize(640, 240);
    1.35  				f.setLocationRelativeTo(null);
    1.36  				f.setVisible(true);
    1.37  			} else {
    1.38 -				ukončiChybou("Soubor neexistuje: " + soubor);
    1.39 +				ukončiChybou(MessageFormat.format(překlady.getString("chyba.souborNeexistuje"), soubor));
    1.40  			}
    1.41  		} else {
    1.42 -			ukončiChybou("Očekávám právě jeden parametr – název souboru.");
    1.43 +			ukončiChybou(překlady.getString("chyba.chybíParametr"));
    1.44  		}
    1.45  	}
    1.46  
    1.47  	private static void ukončiChybou(String hláška) {
    1.48  		log.log(Level.SEVERE, hláška);
    1.49 -		JOptionPane.showMessageDialog(null, hláška, "Chyba", JOptionPane.ERROR_MESSAGE);
    1.50 +		JOptionPane.showMessageDialog(null, hláška, překlady.getString("chyba.titulek"), JOptionPane.ERROR_MESSAGE);
    1.51  		System.exit(1);
    1.52  	}
    1.53  }