/*
 * $Id: GdrnTerm.java,v 1.1 2004/12/23 12:15:53 rampil Exp $
 * Copyright (c) 2004 LOGICAL-PARADOX.ORG
 */
package org.logical_paradox.gdrn;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;

import javax.swing.JFrame;

import org.logical_paradox.console.ConsoleConfig;
import org.logical_paradox.console.gui.ConsolePanel;
import org.logical_paradox.console.gui.ConsoleWindow;

/**
 * GDRN Terminal
 * The Global Distributed Resource Network Terminal Console<br>
 * 広域分散リソースネットワーク
 * @author satoshi akabane@logical-paradox.org
 * @version $Revision: 1.1 $
 */
public class GdrnTerm {
	/**
	 * メインメソッド
	 * @param args プログラム引数
	 * @throws Exception 処理中に発生してハンドリングされなかった例外
	 */
	public static void main(String[] args) throws Exception {
		PropertyResourceBundle resource = (PropertyResourceBundle)ResourceBundle.getBundle("console");
		int width = Integer.parseInt(resource.getString("WINDOW_WIDTH"));
		int height = Integer.parseInt(resource.getString("WINDOW_HEIGHT"));
		JFrame mainFrm = new JFrame();
		mainFrm.getContentPane().add(new ConsolePanel(new ConsoleConfig("console")));

		mainFrm.setTitle(resource.getString("WINDOW_TITLE"));

		ConsoleWindow wnd = new ConsoleWindow(mainFrm);
		mainFrm.addWindowListener(new WindowAdapter() {
				public void windowClosing(WindowEvent e) {
					System.exit(0);
				}
			}
		);

		Dimension windowLocation = Toolkit.getDefaultToolkit().getScreenSize();
		mainFrm.setLocation(((int)windowLocation.getWidth() - width) /2, ((int)windowLocation.getHeight() - height) /2);
		mainFrm.setSize(new Dimension(width, height));
		mainFrm.setVisible(true);
	}
}
