Package com.wbknez.ktour

Source Code of com.wbknez.ktour.Main

/**
* Copyright 2014 Will Knez
*
* 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.
*/
package com.wbknez.ktour;

import java.util.Properties;

import javax.swing.SwingUtilities;

import com.wbknez.ktour.ui.TourUi;

/**
* Main driver for the Ktour project.
*/
public class Main {

    public static void main(String args[]) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                try {
                    final ClassLoader classLoader =
                            Thread.currentThread().getContextClassLoader();
                    final Properties appProps = new Properties();

                    // Load default configuration.
                    appProps.load(
                          classLoader.getResourceAsStream("config.properties"));

                    // Fix non-8x8 boards; this program does not support them.
                    if(!appProps.getProperty("board.width").equals("8") ||
                            !appProps.containsKey("board.width")) {
                        appProps.setProperty("board.width", "8");
                    }

                    if(!appProps.getProperty("board.height").equals("8") ||
                            !appProps.containsKey("board.height")) {
                        appProps.setProperty("board.height", "8");
                    }

                    // Create and launch application.
                    new TourUi(appProps);
                }
                catch(Exception ex) {
                    ex.printStackTrace();
                }
            }
        });
    }
}
TOP

Related Classes of com.wbknez.ktour.Main

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.