/**
* 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();
}
}
});
}
}