|
The GUI objects for the MVT
The MVT is created with a few different GUI objects. Almost every
tool uses the Plot2DPanel. It
was also useful to create a number of GUI objects that are used over
and over again. These include:
-
TextBoxPanel: most of the gui text boxes on both the
input panels and the options boxes use this. It simply consists of
a JLabel and a JTextField. However, has the
following useful methods:
- public Function getFunction() which parses the string
as a function in the text field and returns a Function or
throws an exception due to an error.
- public Variable getVariable() which parses the string
as a variable in the text field and returns a Variable or
throws an exception due to an error.
- public double getDoubleValue() which parses the string
as a double in the text field and returns a double or
throws an exception due to an error. This uses the
Parser.parseNumber() method which allows the user to
enter a number like "pi" into such a box.
- public double getIntegerValue() which parses the string
as a integer in the text field and returns a int or
throws an exception due to an error.
- InputPanel: Each tool has a panel at the bottom where
most of the basic input is performed. This includes entering the
function(s) and endpoints or other basic input. This class extends a
JPanel and has no basic functionality beyond that. It is used for
consistent structure amoung the tools more than anything.
- OptionsPanel: Like the InputPanel, this is used
for basic structure. Since each tool has a set of options available.
This is usually available for creating the options
- ColorListBox: Since most tools allow the option of
various colors for the components. This is a simple way to choose the
color. This is a simple version of the JColorChooser class.
|