package ru.aifgi.recognizer;

/*
* Copyright 2012 Alexey Ivanov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import ru.aifgi.recognizer.view.ViewUtil;

import java.util.Locale;

/**
 * @author aifgi
 */

public class Main {
    public static void main(final String[] args) {
        setLocale(args);
        Thread.setDefaultUncaughtExceptionHandler(ViewUtil.getApplicationUncaughtExceptionHandler());
        ViewUtil.getMainWindow().setVisible(true);
    }

    private static void setLocale(final String[] args) {
        final String language;
        final String country;

        if (args.length < 2) {
            language = "en";
            country = "US";
        }
        else {
            language = args[0];
            country = args[1];
        }

        final Locale locale = new Locale(language, country);
        Locale.setDefault(locale);
    }
}

@@ -21,20 +21,23 @@
 ognizer;
-%0A
+%0D%0A%0D
 %0A/*
+%0D
 %0A* Copyr
@@ -59,18 +59,20 @@
 y Ivanov
+%0D
 %0A*
+%0D
 %0A* Licen
@@ -129,16 +129,17 @@
 cense%22);
+%0D
 %0A* you m
@@ -197,16 +197,17 @@
 License.
+%0D
 %0A* You m
@@ -240,18 +240,20 @@
 cense at
+%0D
 %0A*
+%0D
 %0A* http:
@@ -289,18 +289,20 @@
 ENSE-2.0
+%0D
 %0A*
+%0D
 %0A* Unles
@@ -363,16 +363,17 @@
 software
+%0D
 %0A* distr
@@ -432,16 +432,17 @@
 %22 BASIS,
+%0D
 %0A* WITHO
@@ -508,16 +508,17 @@
 implied.
+%0D
 %0A* See t
@@ -579,16 +579,17 @@
 ions and
+%0D
 %0A* limit
@@ -617,12 +617,15 @@
 nse.
+%0D
 %0A*/
-%0A
+%0D%0A%0D
 %0Aimp
@@ -662,17 +662,42 @@
 iewUtil;
-%0A
+%0D%0A%0D%0Aimport javax.swing.*;%0D
 %0Aimport 
@@ -717,13 +717,16 @@
 ale;
-%0A
+%0D%0A%0D
 %0A/**
+%0D
 %0A * 
@@ -742,13 +742,16 @@
 ifgi
+%0D
 %0A */
-%0A
+%0D%0A%0D
 %0Apub
@@ -766,16 +766,17 @@
 s Main %7B
+%0D
 %0A    pub
@@ -810,32 +810,33 @@
 String%5B%5D args) %7B
+%0D
 %0A        setLoca
@@ -844,16 +844,17 @@
 e(args);
+%0D
 %0A       
@@ -947,17 +947,135 @@
 dler());
+%0D
 %0A
+        SwingUtilities.invokeLater(new Runnable() %7B%0D%0A            @Override%0D%0A            public void run() %7B%0D%0A        
         
@@ -1116,23 +1116,54 @@
 e(true);
+%0D
 %0A    
-%7D%0A
+        %7D%0D%0A        %7D);%0D%0A    %7D%0D%0A%0D
 %0A    pri
@@ -1211,16 +1211,17 @@
  args) %7B
+%0D
 %0A       
@@ -1243,16 +1243,17 @@
 anguage;
+%0D
 %0A       
@@ -1274,17 +1274,19 @@
 country;
-%0A
+%0D%0A%0D
 %0A       
@@ -1308,16 +1308,17 @@
 h %3C 2) %7B
+%0D
 %0A       
@@ -1338,16 +1338,17 @@
  = %22en%22;
+%0D
 %0A       
@@ -1367,16 +1367,17 @@
  = %22US%22;
+%0D
 %0A       
@@ -1378,16 +1378,17 @@
        %7D
+%0D
 %0A       
@@ -1394,16 +1394,17 @@
   else %7B
+%0D
 %0A       
@@ -1427,16 +1427,17 @@
 args%5B0%5D;
+%0D
 %0A       
@@ -1459,16 +1459,17 @@
 args%5B1%5D;
+%0D
 %0A       
@@ -1470,17 +1470,19 @@
        %7D
-%0A
+%0D%0A%0D
 %0A       
@@ -1534,16 +1534,17 @@
 ountry);
+%0D
 %0A       
@@ -1574,13 +1574,16 @@
 le);
+%0D
 %0A    %7D
+%0D
 %0A%7D
+%0D
 %0A

create main window in event dispatch thread