| [29] | 1 | /* |
|---|
| 2 | * This program is free software; you can redistribute it and/or modify |
|---|
| 3 | * it under the terms of the GNU General Public License as published by |
|---|
| 4 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 5 | * (at your option) any later version. |
|---|
| 6 | * |
|---|
| 7 | * This program is distributed in the hope that it will be useful, |
|---|
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 10 | * GNU General Public License for more details. |
|---|
| 11 | * |
|---|
| 12 | * You should have received a copy of the GNU General Public License |
|---|
| 13 | * along with this program; if not, write to the Free Software |
|---|
| 14 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 15 | */ |
|---|
| 16 | |
|---|
| 17 | /* |
|---|
| 18 | * SimpleCLI.java |
|---|
| 19 | * Copyright (C) 1999 University of Waikato, Hamilton, New Zealand |
|---|
| 20 | * |
|---|
| 21 | */ |
|---|
| 22 | |
|---|
| 23 | package weka.gui; |
|---|
| 24 | |
|---|
| 25 | import weka.gui.scripting.ScriptingPanel; |
|---|
| 26 | |
|---|
| 27 | import java.awt.BorderLayout; |
|---|
| 28 | |
|---|
| 29 | import javax.swing.JFrame; |
|---|
| 30 | |
|---|
| 31 | /** |
|---|
| 32 | * Creates a very simple command line for invoking the main method of |
|---|
| 33 | * classes. System.out and System.err are redirected to an output area. |
|---|
| 34 | * Features a simple command history -- use up and down arrows to move |
|---|
| 35 | * through previous commmands. This gui uses only AWT (i.e. no Swing). |
|---|
| 36 | * |
|---|
| 37 | * @author Len Trigg (trigg@cs.waikato.ac.nz) |
|---|
| 38 | * @author FracPete (fracpete at waikato dot ac dot nz) |
|---|
| 39 | * @version $Revision: 5142 $ |
|---|
| 40 | */ |
|---|
| 41 | public class SimpleCLI |
|---|
| 42 | extends JFrame { |
|---|
| 43 | |
|---|
| 44 | /** for serialization. */ |
|---|
| 45 | static final long serialVersionUID = -50661410800566036L; |
|---|
| 46 | |
|---|
| 47 | /** |
|---|
| 48 | * Constructor. |
|---|
| 49 | * |
|---|
| 50 | * @throws Exception if an error occurs |
|---|
| 51 | */ |
|---|
| 52 | public SimpleCLI() throws Exception { |
|---|
| 53 | SimpleCLIPanel panel; |
|---|
| 54 | |
|---|
| 55 | panel = new SimpleCLIPanel(); |
|---|
| 56 | |
|---|
| 57 | setLayout(new BorderLayout()); |
|---|
| 58 | setTitle(panel.getTitle()); |
|---|
| 59 | setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); |
|---|
| 60 | setIconImage(panel.getIcon().getImage()); |
|---|
| 61 | add(panel); |
|---|
| 62 | pack(); |
|---|
| 63 | setSize(600, 500); |
|---|
| 64 | setLocationRelativeTo(null); |
|---|
| 65 | setVisible(true); |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | /** |
|---|
| 69 | * Method to start up the simple cli. |
|---|
| 70 | * |
|---|
| 71 | * @param args Not used. |
|---|
| 72 | */ |
|---|
| 73 | public static void main(String[] args) { |
|---|
| 74 | ScriptingPanel.showPanel(new SimpleCLIPanel(), args, 600, 500); |
|---|
| 75 | } |
|---|
| 76 | } |
|---|