Issue: Too get input from the user, there must be input components that display a value and accept input. However, there is much more to it than that. There must be a label, to explain to the user what information you want. And, a way to get help on what information you want, and, the ability to provide an alternate way to get that information, in case the primary way does not make sense to the user. For the purposes here, I will use the term "component" to refer to low level Java Swing components, and the term "field" to refer to the complete input line, consisting of several "components".
Discussion: The lowest level input, or edit, components are the
standard Java Swing components. These provide the basic entry/display
capabilities to have data entered/displayed and retrieved when needed. The
following is a list of the components I use:
- JTextField - Normal unformatted text (String) input.
- JFormattedTextField - A JTextField using a format for input.
- JComboBox - A drop down list with an option to allow direct entry of a new item. Items are objects.
- JSpinner - A display of one item in a list, with arrows to progress up or down in the list. Only one item in the list may be selected.
- JButton - Used in some situations to usually bring up another screen.
- JList - a list of items, one to be selected.
- JRadioButton - One of a few options, only one is to be selected.
Discussion: The components above provide the basic components
for input, however, there are other components which will be part of the actual
entry field that the user will see. Every one of these is
optional, that is, not every field will have each or any of these
components. These are:
- JLabel - A label to describe the information desired. In some cases, a label may appear before, after the input component, or both.
- Help Button - Optional item to allow the user to request help on how to complete this field, or what it means.
- Alternate Input Button - In some cases (Date for example), the user may prefer to use another type of input. A calendar widget in addition to a date formatted text field, for example.
Discussion: Originally, I wanted a minimal screen, so I had
planned on using a right click on the label to bring up the help screen.
But,
with the rise of tablets and other touch screen devices, right clicking would
be impossible. So, now I am using a help button, next to the label, to
allow the user to get the help screen. My preference would be for the
help button to be a custom, round button of a question mark. The help
button is optional, so it won't appear with every entry field. I also
had planned to have a ToolTip assigned to every input component, but this
too was discarded because of the rise of touch screen devices. So, here
are the various fields, what other components will go with them, and an example:
Discussion:Thus in a left to right orientation, a sample
edit field might look like: