John W. Campbell
This class provides a window for the input and output of text strings.
A command recall facility is implemented and cutting/pasting can be
done.
Class, fields, constructor and methods:
Class Details
Accessible Fields
Constructor
Operational Methods
Add/Remove Action Listener
Get Returned Data
Overriden Superclass Methods
- Package:
- Jdl.JdlView;
- Class name:
- JdlIOWindow
- Class definition:
- public class JdlIOWindow
- Extends:
- JdlDrawPanel
- Implements:
- FocusListener
MouseListener
KeyListener
ActionListener
ChangeListener
JdlViewObject
- Actions:
- An action event will be generated when a (command) string is input. The
associated object is the input string.
The following accessible fields have been defined:
- public final static int PREFERRED
- Size Constraint: preferred size.
- public final static int FREE
- Size/Location Constraint: free.
- static final long serialVersionUID
A single constructor is available.
Constructor:
Standard constructor
Constructs a JdlIOWindow object with the required resources.
- Constructor Definition:
- public JdlIOWindow(int rows, int cols, String typical, JdlViewOptions view_opts)
- Parameters List:
- rows
- The required number of rows if characters.
- cols
- The required number of columns of characters.
- typical
- A typical string for defining the character column width. If
null then the width of the character 'm' is used by default.
- view_opts
- Object to set non-default options for borders, active strip,
colours and fonts.
This section has methods to output a text string, to enable text input and
to enable editing of a reply string.
Methods:
Output a text string - outputString
Set input mode - setInputMode
Set editable reply - setEditableReplyString
Set Font - setFontType
Set Tabs - setTabSize
Set position constraints - setLocationConstraints
Set size constraints - setSizeConstraints
Set minimum height - setMinimumHeight
Set minimum width - setMinimumWidth
This method outputs a text string to the window with a selected carriage
control option. Note: If input mode is currently on then input mode
will be turned off.
- Method Definition:
- public void outputString (String str, int nl)
- Parameters List:
- str
- The string to be output including any newline (\n) characters
required. The characters \f, \v, \r will be treated as newline characters.
For strings without newline characters, use the 'nl' flag to handle any
newline requirements.
- nl
- Newline flag:
= 0, do not add any newline characters to the string
= 1, add one before outputting the string
= 2, add one after outputting the string
= 3, add one before and after outputting the string
This method sets (or unsets) text (command) input mode.
- Method Definition:
- public void setInputMode (boolean on)
- Parameters List:
- on
- True for on, else false for off.
This method outputs an editable reply string (also sets the text input
mode to 'on'). The reply may be edited, as needed, before confirming it
using the Enter key.
- Method Definition:
- public void setEditableReplyString (String reply)
- Parameters List:
- reply
- The reply string to be edited.
This method selects a new font for the text window from the set
of 'standard' fonts.
- Method Definition:
- public void setFontType(int ifont)
- Parameters List:
- ifont
- Font type code:
= 1, standard font
= 2, standard bold font
= 3, standard italic font
= 4, fixed font
= 5, fixed bold font
= 6, fixed italic font
= 7, small fixed font
This method sets the tab width for the text area.
- Method Definition:
- public void setTabSize(int nc)
- Parameters List:
- none
Set constraints on the Jdl object positioning.
- Method Definition:
- public void setLocationConstraints (int constraint_x, int constraint_y)
- Parameters List:
- constraint_x
- Constrain the Jdl Object 'x' position = the required
Jdl Object 'x' position (overrides setLocation method) or FREE if the 'x'
position may be set by the setLocation method and hence possibly by the
layout manager.
- constraint_y
- Constrain the Jdl Object 'y' position = the required
the Jdl Object 'y'position (overrides setLocation method) or FREE if the 'y'
position may be set by the setLocation method and hence possibly by the
layout manager.
Set constraints on the Jdl Object resizing permitted.
- Method Definition:
- public void setSizeConstraints (int constraint_w, int constraint_h)
- Parameters List:
- constraint_w
- Constrain the Jdl Object width = the required
Jdl Object width, or PREFERRED (default) if the width is to be calculated
from the current resources, or FREE if the width may be resized to anything
greater than the minimum width required.
- constraint_h
- Constrain the Jdl Object height = the required
Jdl Object height, or PREFERRED (default) if the height is to be calculated
from the current resources, or FREE if the height may be resized to anything
greater than the minimum height required.
Set the minimum height resource.
- Method Definition:
- public void setMinimumHeight(int minh)
- Parameters List:
- minh
- The minimum height required for the object (ignored if less
than that required by the minimum layout) (default = 0).
Set the minimum width resource.
- Method Definition:
- public void setMinimumWidth(int minw)
- Parameters List:
- minh
- The minimum width required for the object (ignored if less
than that required by the minimum layout) (default = 0).
This section has methods to add or remove an action listener.
Methods:
Add action listener - addActionListener
Remove action listener - removeActionListener
This adds the specified action listener to receive action events from this
object.
- Method Definition:
- public void addActionListener(ActionListener listener)
- Parameters List:
- listener
- The action listener to be added.
This removes the specified action listener so that it no longer receives action
events from this object.
- Method Definition:
- public void removeActionListener(ActionListener listener)
- Parameters List:
- listener
- The action listener to be removed.
This section has methods to get data from the object relating to an
action and following that action.
Methods:
Get input string - getReturnedData
This method returns the last the input string.
- Method Definition:
- public String getReturnedData()
- Parameters List:
- none
- Method Return:
-
Returns the last input string.
This section contains methods which override the corresponding superclass
methods. These are basically standard for JdlView objects and comprise
methods to set background and foreground colours and to get the minimum
and preferred sizes for the object. (The paintComponent and setSize methods
are also over-ridden but they are not normally called by the user).
Methods:
Set background - setBackground
Set background colours - setBackground
Set foreground - setForeground
Get minimum size - getMinimumSize
Get preferred size - getPreferredSize
This method sets the background colour resource.
- Method Definition:
- public void setBackground (Color c)
- Parameters List:
- c
- The color to become this object's background color.
This method sets the background colour resource and brighter and darker shades
of that colour (e.g. for 3-D frames).
- Method Definition:
- public void setBackground (Color c, Color brighter, Color darker)
- Parameters List:
- c
- The background colour.
- brighter
- A brighter shade of the background colour.
- darker
- A darker shade of the background colour.
This method sets the foreground colour resource.
- Method Definition:
- public void setForeground (Color c)
- Parameters List:
- c
- The color to become this object's foreground color.
This method returns the minimum size of the component.
- Method Definition:
- public Dimension getMinimumSize()
- Parameters List:
- none
This method returns the preferred size of the component.
- Method Definition:
- public Dimension getPreferredSize()
- Parameters List:
- none
⇑ Up 3
⇑ Up 2
⇑ Up 1
⇑ Top of this