Main.java
/*
* $RCSfile: Main.java,v $
* $Id: Main.java,v 1.6 1998/11/30 02:21:07 devnull Exp $
* by Lee Wilson, http://www.ad1440.net/~devnull
* Development started on 1998 10 01
* (c) Devnull Software, LLC.
*/
package com.devnullsoftware.javaterrain;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import edu.cornell.lassp.houle.RngPack.*;
import com.devnullsoftware.config.*;
/**
* The main manager class.
*
* @version 1.0 $Date$
* @author Lee Wilson (devnull@ad1440.net)
*/
public class Main extends JApplet implements ActionListener {
//-------------------------------------------------------------------
// Global Constants
//
//-------------------------------------------------------------------
// Instance Variables
//
/** Random Number Generator */
public static Ranmar pRandomizer;
public static Main pThisApplet;
//---------------------------------------------------------------------------
// Constructors
//
public Main ()
{
init();
}
/**
The main initialization class for the applet. Automatically Called by
the browser when the applet is run.
*/
public void init () {
// Set up global vars
if (pThisApplet == null) {
pThisApplet = this;
}
else {
System.out.println("Applet already running. Killing this one");
stop();
super.destroy();
return;
}
pRandomizer = new Ranmar(new Date().getTime());
// Set up Components
initComponents();
}
private void initComponents () {
JPanel pMainPanel = new JPanel(new BorderLayout());
pMainPanel.add("Center", button("Create World"));
getContentPane().add(pMainPanel);
}
public JButton button (String sLabel) {
JButton cButton = new JButton(sLabel);
cButton.addActionListener(this);
return (cButton);
}
//-------------------------------------------------------------------
// Accessors & Mutators
//
//-------------------------------------------------------------------
// Security
//
//---------------------------------------------------------------------------
// Methods
//
/**
Utility routine to direct output
@param sOut the string to be printed to stdout.
*/
public static void output (String sOut) {
System.out.print (sOut);
}
//---------------------------------------------------------------------------
// ActionListener Interface
//
public void actionPerformed (ActionEvent pEvent) {
String arg = pEvent.getActionCommand();
if ("Create World".equals(arg)) {
// Create a world
MapParams pMP1 = new MapParams ();
ConfigWindow pCW1 = new ConfigWindow (pMP1);
}
}
}