import java.awt.*; import java.applet.*; public class PetaSIM extends Applet implements Runnable { Thread runner; Button button1, button2; public int howmanyClicked = 0; public void add(Component c, GridBagLayout gbl, GridBagConstraints gbc, int x, int y, int w, int h) { gbc.gridx = x; gbc.gridy = y; gbc.gridwidth = w; gbc.gridheight = h; gbl.setConstraints(c,gbc); add(c); } public void init() { //setLayout(new FlowLayout()); //setLayout(new BorderLayout()); GridBagLayout gbl = new GridBagLayout(); setLayout(gbl); this.resize(800,600); Label numNodeLabel = new Label("Number of Nodes?",Label.RIGHT); TextField numNodeTxt = new TextField(5); Label numLinkLabel = new Label("Number of Links?",Label.RIGHT); TextField numLinkTxt = new TextField(5); Button okButton = new Button("OK"); GridBagConstraints gbc = new GridBagConstraints(); //gbc.weightx = .1; //gbc.weighty = .1; gbc.ipadx = 30; gbc.ipady = 5; add(numNodeLabel, gbl, gbc, 0, 0, 1, 1); add(numNodeTxt, gbl, gbc, 1, 0, 1, 1); add(numLinkLabel, gbl, gbc, 0, 1, 1, 1); add(numLinkTxt, gbl, gbc, 1, 1, 1, 1); gbc.ipadx = 35; gbc.ipady = 15; add(okButton, gbl, gbc, 0, 2, 4, 1); /* NodeSetControls nodeSetPanel = new NodeSetControls(this); DataSetControls dataSetPanel = new DataSetControls(); DistribControls distribPanel = new DistribControls(); ExScriptControls exscriptPanel = new ExScriptControls(); add(nodeSetPanel); add(dataSetPanel); add(distribPanel); add(exscriptPanel); */ } public boolean action(Event evt, Object obj) { String command = (String)obj; if (command.equals("OK")) { int numNode = Format.atoi(numNodeTxt.getText()); int numLink = Format.atoi(numLinkTxt.getText()); ArchitectureWin arch = new ArchitectureWin(); ApplicationWin appl = new ApplicationWin(); arch.show(); appl.show(); //NodeSetWin tester = new NodeSetWin(this); //tester.resize(250, 300); // tester.pack(); // howmanyClicked++; //tester.setTitle("Node " + howmanyClicked); tester.show(); } else return false; return true; } public void start() { runner = new Thread(this); runner.start(); } public void stop() { if (runner != null) runner.stop(); } public void run() { } };