// SpecTcl generated class Demo1, version 1.2

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

public class Demo1 extends Demo1App implements ActionListener {		

// a slot to hold an arbitrary object pointer that can
// be filled in by the app. and referenced in actions
private Object arg;

private JPanel frame_1;
private JButton button_1;
private JLabel label_1;
private JButton button_2;
private JLabel label_2;
private JTextField entry_1;

//methods to support form introspection
private static String names[] = {
	"frame_1","button_1","label_1","button_2","label_2","entry_1",
};
public String[] getNames() {
	return names;
}

//There should be an easier way to do this
public Object[] getWidgets() {
	Object[] list = new Object[6];
	list[0] = frame_1;
	list[1] = button_1;
	list[2] = label_1;
	list[3] = button_2;
	list[4] = label_2;
	list[5] = entry_1;
	return list;
}

public void init() {

	// main panel
	GridBagLayout grid = new GridBagLayout();
	int rowHeights[] = {0,30,30,30};
	int columnWidths[] = {0,30,30};
	double rowWeights[] = {0.0,0.0,0.0,0.0};
	double columnWeights[] = {0.0,0.0,0.0};
	grid.rowHeights = rowHeights;
	grid.columnWidths = columnWidths;
	grid.rowWeights = rowWeights;
	grid.columnWeights = columnWeights;

	// container frame_1 in this.
	GridBagLayout frame_1_grid = new GridBagLayout();
	int frame_1_rowHeights[] = {0,30};
	int frame_1_columnWidths[] = {0,30,30};
	double frame_1_rowWeights[] = {0.0,0.0};
	double frame_1_columnWeights[] = {0.0,0.0,0.0};
	frame_1_grid.rowHeights = frame_1_rowHeights;
	frame_1_grid.columnWidths = frame_1_columnWidths;
	frame_1_grid.rowWeights = frame_1_rowWeights;
	frame_1_grid.columnWeights = frame_1_columnWeights;

	frame_1 = new JPanel();
	this.getContentPane().add(frame_1);

	button_1 = new JButton();
	button_1.addActionListener(this);
	button_1.setFont(new Font("Helvetica",Font.PLAIN + Font.BOLD , 16));
	button_1.setText("Yes");
	frame_1.add(button_1);

	label_1 = new JLabel();
	label_1.setFont(new Font("Helvetica",Font.PLAIN + Font.BOLD , 16));
	label_1.setText("Demo 1");
	this.getContentPane().add(label_1);

	button_2 = new JButton();
	button_2.addActionListener(this);
	button_2.setFont(new Font("Helvetica",Font.PLAIN + Font.BOLD , 16));
	button_2.setText("No");
	frame_1.add(button_2);

	label_2 = new JLabel();
	label_2.setFont(new Font("Helvetica",Font.PLAIN + Font.BOLD , 16));
	label_2.setText("stuff:");
	this.getContentPane().add(label_2);

	entry_1 = new JTextField(20);
	entry_1.addActionListener(this);
	entry_1.setFont(new Font("Helvetica",Font.PLAIN , 16));
	this.getContentPane().add(entry_1);

	// Geometry management
	GridBagConstraints con = new GridBagConstraints();
	reset(con);
	con.gridx = 1;
	con.gridy = 3;
	con.gridwidth = 2;
	con.anchor = GridBagConstraints.CENTER;
	con.fill = GridBagConstraints.NONE;
	grid.setConstraints(frame_1, con);

	reset(con);
	con.gridx = 1;
	con.gridy = 1;
	con.anchor = GridBagConstraints.CENTER;
	con.fill = GridBagConstraints.NONE;
	frame_1_grid.setConstraints(button_1, con);

	reset(con);
	con.gridx = 1;
	con.gridy = 1;
	con.gridwidth = 2;
	con.anchor = GridBagConstraints.CENTER;
	con.fill = GridBagConstraints.NONE;
	grid.setConstraints(label_1, con);

	reset(con);
	con.gridx = 2;
	con.gridy = 1;
	con.anchor = GridBagConstraints.CENTER;
	con.fill = GridBagConstraints.NONE;
	frame_1_grid.setConstraints(button_2, con);

	reset(con);
	con.gridx = 1;
	con.gridy = 2;
	con.anchor = GridBagConstraints.CENTER;
	con.fill = GridBagConstraints.NONE;
	grid.setConstraints(label_2, con);

	reset(con);
	con.gridx = 2;
	con.gridy = 2;
	con.anchor = GridBagConstraints.CENTER;
	con.fill = GridBagConstraints.NONE;
	grid.setConstraints(entry_1, con);


	// Resize behavior management and parent heirarchy
	this.getContentPane().setLayout(grid);
	//Set the Background Color
	this.getContentPane().setBackground(new Color(59293/256,60333/256,53052/256));
	frame_1.setLayout(frame_1_grid);
	//Set the Background Color
	frame_1.setBackground(new Color(59293/256,60333/256,53052/256));

	// Give the application a chance to do its initialization
	super.init();
}

public void actionPerformed(ActionEvent event) {
	if (event.getSource() == button_1) {
		my_action("yes button");
	}
	if (event.getSource() == button_2) {
		my_action("no button");
	}
	if (event.getSource() == entry_1) {
		my_action(entry_1.getText());
	}
}

public static void main(String[] args) {
    JFrame f = new JFrame("Demo1 Test");
    Demo1 win = new Demo1();
    f.addWindowListener(
       new WindowAdapter()
       {
             public void windowClosing(WindowEvent e)
             {
                 System.exit(0);
             }
        }
    );
    win.init();
    f.getContentPane().add("Center", win);
    f.pack();
    f.setVisible(true);
}

private void reset(GridBagConstraints con) {
    con.gridx = GridBagConstraints.RELATIVE;
    con.gridy = GridBagConstraints.RELATIVE;
    con.gridwidth = 1;
    con.gridheight = 1;
 
    con.weightx = 0;
    con.weighty = 0;
    con.anchor = GridBagConstraints.CENTER;
    con.fill = GridBagConstraints.NONE;
 
    con.insets = new Insets(0, 0, 0, 0);
    con.ipadx = 0;
    con.ipady = 0;
}

}
