package voxel.client.core.launcher;

import java.awt.Dimension;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;

import voxel.client.core.MainClient;
import voxel.client.core.launcher.login.LoginDialog;
import voxel.client.core.launcher.properties.Reader;
import voxel.client.core.launcher.webpage.LoadingWebPage;
import voxel.client.core.util.Logger;

public class Launcher {

	public static void LauncherStart() {
		ImageIcon imgicon = new ImageIcon(Reader.IconPath);
		ImageIcon imgicon1 = new ImageIcon(Reader.BackPath);

		Logger.log(ConstantsLauncher.launcherVersion);

		final JFrame frame = new JFrame("Launcher " + ConstantsLauncher.gameName);
		final JButton btnLogin = new JButton("Login");
		final JButton btnExit = new JButton("Exit");
		final JButton btnWeb = new JButton("News");

		Insets insets = frame.getInsets();
		Dimension size = btnLogin.getPreferredSize();
		btnLogin.setBounds(560 + insets.left, 630 + insets.top, size.width,
				size.height);
		size = btnExit.getPreferredSize();
		btnExit.setBounds(640 + insets.left, 630 + insets.top, size.width,
				size.height);
		btnWeb.setBounds(740 + insets.left, 630 + insets.top, 100, size.height);
		Logger.log("Launcher Started");
		btnLogin.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				LoginDialog loginDlg = new LoginDialog(frame);
				loginDlg.setVisible(true);
				// if logon successfully
				if (loginDlg.isSucceeded()) {
					frame.dispose();
					Logger.log("Starting Voxel");
					MainClient.LaunchVoxel();
				}
			}
		});
		btnExit.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Logger.log("Launcher Closed");
				frame.dispose();
				System.exit(0);
			}

		});
		btnWeb.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Logger.log("Loading News");
				Logger.log("Loading " + ConstantsLauncher.url);
				LoadingWebPage.main();
			}

		});
		frame.setSize(1280 + insets.left + insets.right, 720 + insets.top
				+ insets.bottom);
		frame.setLayout(null);
		frame.setIconImage(imgicon.getImage());
		frame.setContentPane(new JLabel(new ImageIcon(imgicon1.getImage())));
		frame.getContentPane().add(btnLogin);
		frame.getContentPane().add(btnExit);
		frame.getContentPane().add(btnWeb);
		frame.setVisible(true);
		frame.setLocation(85, 85);
		frame.setResizable(false);
		frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	}
}
@@ -776,17 +776,21 @@
 uncher %22
- 
+%0A%09%09%09%09
 + Consta
@@ -953,16 +953,69 @@
 %22News%22);
+%0A%09%09final JButton btnOptions = new JButton(%22Options%22);
 %0A%0A%09%09Inse
@@ -1305,16 +1305,52 @@
 eight);%0A
+%09%09size = btnWeb.getPreferredSize();%0A
 %09%09btnWeb
@@ -1416,16 +1416,139 @@
 eight);%0A
+%09%09size = btnOptions.getPreferredSize();%0A%09%09btnOptions.setBounds(850 + insets.left, 630 + insets.top, 100,%0A%09%09%09%09size.height);%0A
 %09%09Logger
@@ -2317,32 +2317,146 @@
 e.main();%0A%09%09%09%7D%0A%0A
+%09%09%7D);%0A%09%09btnOptions.addActionListener(new ActionListener() %7B%0A%09%09%09public void actionPerformed(ActionEvent e) %7B%0A%09%09%09%7D%0A%0A
 %09%09%7D);%0A%09%09frame.se
@@ -2753,16 +2753,16 @@
 nExit);%0A
-
 %09%09frame.
@@ -2791,16 +2791,58 @@
 tnWeb);%0A
+%09%09frame.getContentPane().add(btnOptions);%0A
 %09%09frame.

Add Options button to launcher