Class JtvColorDialog
public class JtvColorDialog
extends JtvDialog
A full-featured colour selection dialog box.
TColorDialog gives users a visual interface for changing any combination of foreground and background colours in the application's palette. It is titled "Colors" and contains:
- A colour-group list showing top-level categories.
- A colour-item list showing the individual palette entries in the selected group.
- Foreground and background JtvColorSelector grids.
- A JtvColorDisplay preview showing sample text in the selected colours.
- A hidden JtvMonoSelector shown on monochrome displays.
- OK and Cancel buttons.
The palette being edited is passed to the constructor and a copy is held in
pal. getDataTo(Object) and setDataFrom(Object) transfer
the palette to/from a caller-supplied JtvPalette record.
The static colorIndexes field remembers the last focused group and
per-group item selections across dialog invocations.
org.viktor44.jtvision.dialogs.JtvColorDialog
Summary
Constructors
| Visibility | Signature |
|---|---|
| public | JtvColorDialog(JtvPalette aPalette, List<org.viktor44.jtvision.dialogs.JtvColorGroup> aGroups) |
Fields
| Modifiers | Field name | Type |
|---|---|---|
| private static | colorIndexes | org.viktor44.jtvision.dialogs.JtvColorIndex |
| private static final | colors | String |
| private static final | groupText | String |
| private static final | itemText | String |
| private static final | forText | String |
| private static final | bakText | String |
| private static final | textText | String |
| private static final | colorText | String |
| private static final | okText | String |
| private static final | cancelText | String |
| private | pal | org.viktor44.jtvision.core.JtvPalette |
| private | display | org.viktor44.jtvision.dialogs.JtvColorDisplay |
| private | groups | org.viktor44.jtvision.dialogs.JtvColorGroupList |
| private | forLabel | org.viktor44.jtvision.dialogs.JtvLabel |
| private | forSel | org.viktor44.jtvision.dialogs.JtvColorSelector |
| private | bakLabel | org.viktor44.jtvision.dialogs.JtvLabel |
| private | bakSel | org.viktor44.jtvision.dialogs.JtvColorSelector |
| private | monoLabel | org.viktor44.jtvision.dialogs.JtvLabel |
| private | monoSel | org.viktor44.jtvision.dialogs.JtvMonoSelector |
| private | groupIndex | int |
Methods
| Modifiers | Method signature | Return type |
|---|---|---|
| public | handleEvent(JtvEvent event) | void |
| public | getDataTo(Object rec) | void |
| public | setDataFrom(Object rec) | void |
| private | setIndexes() | void |
| private | getIndexes() | void |
Constructors
JtvColorDialog(JtvPalette aPalette, List<org.viktor44.jtvision.dialogs.JtvColorGroup> aGroups)
Creates the colour dialog box.
Builds and inserts a 61×18 centred dialog with a group list, item list,
foreground/background colour selectors, a preview display, a hidden monochrome
selector, and OK/Cancel buttons. If aPalette is non-null, the dialog
is pre-populated via setDataFrom(Object).
Parameters
aPalette- the application palette to edit; a copy is kept internallyaGroups- the list ofJtvColorGroupobjects defining the palette categories
Fields
org.viktor44.jtvision.dialogs.JtvColorIndex colorIndexes
Static storage for the per-group selected-item indices, shared across successive openings of the colour dialog.
String colors
No description provided
String groupText
No description provided
String itemText
No description provided
String forText
No description provided
String bakText
No description provided
String textText
No description provided
String colorText
No description provided
String okText
No description provided
String cancelText
No description provided
org.viktor44.jtvision.core.JtvPalette pal
Working copy of the application palette being edited.
org.viktor44.jtvision.dialogs.JtvColorDisplay display
Preview view showing text in the selected colours.
org.viktor44.jtvision.dialogs.JtvColorGroupList groups
List viewer for colour group names.
org.viktor44.jtvision.dialogs.JtvLabel forLabel
Label for the foreground colour selector.
org.viktor44.jtvision.dialogs.JtvColorSelector forSel
Foreground colour selector grid.
org.viktor44.jtvision.dialogs.JtvLabel bakLabel
Label for the background colour selector.
org.viktor44.jtvision.dialogs.JtvColorSelector bakSel
Background colour selector grid.
org.viktor44.jtvision.dialogs.JtvLabel monoLabel
Label for the monochrome attribute selector (shown only on monochrome displays).
org.viktor44.jtvision.dialogs.JtvMonoSelector monoSel
Monochrome attribute selector (hidden on colour displays).
int groupIndex
Index of the most recently focused colour group.
Persisted via the static colorIndexes field.
Methods
handleEvent(JtvEvent event)
Overrides:
handleEvent(JtvEvent event) in org.viktor44.jtvision.dialogs.JtvDialog
Extends the inherited event handler to:
- Save the focused group index on
cmNewColorItembroadcasts. - Update the colour display on
cmNewColorIndexbroadcasts.
Parameters
event- the incoming event
getDataTo(Object rec)
Copies the current (edited) palette into the caller-supplied JtvPalette record
after saving the current group/item selection indices to the static
colorIndexes.
Parameters
rec- aJtvPaletteto receive the edited palette data
setDataFrom(Object rec)
Loads a new palette from rec, restores the saved group/item selection
indices, and updates the colour display.
Parameters
rec- aJtvPalettecontaining the palette to edit
setIndexes()
Restores the per-group item selection indices from the static
colorIndexes into the group list.
getIndexes()
Saves the current per-group item selection indices into the static
colorIndexes for use in subsequent dialog openings.