/* OpenShell: A simple Java application that creates a Tcl Shell * * Copyright (c) 1998 The Regents of the University of California. * All Rights Reserved. See the COPYRIGHT file for details. */ package tutorial.tcltk98; import java.awt.*; import java.awt.event.*; class OpenShell { Frame mainFrame; Button openButton; public OpenShell () { openButton = new Button(); openButton.setLabel("Open Tcl Shell"); openButton.addActionListener(new ShellOpener()); mainFrame = new Frame(); mainFrame.pack(); mainFrame.setSize(200,200); mainFrame.add(openButton); mainFrame.show(); // Make it closeable mainFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } public static void main (String argv[]) { OpenShell shell = new OpenShell(); } class ShellOpener implements ActionListener { public void actionPerformed (ActionEvent e) { TclShell tclShell = new TclShell(); final Frame shellFrame = new Frame(); shellFrame.pack(); shellFrame.setSize(400,200); shellFrame.add(tclShell); shellFrame.show(); // Make it closeable shellFrame.addWindowListener( new WindowAdapter() { public void windowClosing (WindowEvent e) { shellFrame.dispose(); } }); } } }