Skip to main content

Class JtvMonoSelector

public class JtvMonoSelector
extends JtvCluster

A radio-button cluster for selecting monochrome text attributes.

JtvMonoSelector is a specialised JtvCluster used by JtvColorDialog on monochrome displays (when showMarkers is true). It offers five predefined text attribute choices: Normal, Highlight, Underline, Inverse, and Bold.

Selecting an item sets JtvCluster.value to the corresponding CGA attribute byte and broadcasts cmColorForegroundChanged and cmColorBackgroundChanged so other views in the dialog update accordingly.

Responds to cmColorSet broadcasts by updating its selection to match the closest predefined attribute.

org.viktor44.jtvision.dialogs.JtvMonoSelector

Summary​

Constructors​

VisibilitySignature
publicJtvMonoSelector(JtvRect bounds)

Fields​

ModifiersField nameType
private static finalmonoColorsint[]
private static finalbuttonString
private static finalitemsString[]

Methods​

ModifiersMethod signatureReturn type
publicdraw()void
publichandleEvent(JtvEvent event)void
publicmark(int item)boolean
publicnewColor()void
publicpress(int item)void
publicmovedTo(int item)void

Constructors​

JtvMonoSelector(JtvRect bounds)​

Creates a monochrome attribute selector with the given bounds. Uses the predefined item labels and listens for cmColorSet broadcasts.

Parameters

  • bounds - the bounding rectangle

Fields​

int[] monoColors​

CGA attribute bytes for each selectable monochrome style: Normal (0x07), Highlight (0x0F), Underline (0x01), Inverse (0x70), Bold (0x09).

String button​

Radio-button icon template.

String[] items​

Item labels for the five monochrome attribute choices.

Methods​

draw()​

Draws the monochrome attribute options as radio buttons.

handleEvent(JtvEvent event)​

Overrides:

handleEvent(JtvEvent event) in org.viktor44.jtvision.dialogs.JtvCluster

Handles cmColorSet broadcasts by updating the selected item to the one whose CGA attribute matches the received value.

Parameters

  • event - the incoming event

mark(int item)​

Overrides:

mark(int item) in org.viktor44.jtvision.dialogs.JtvCluster

Returns true if the item at item corresponds to the current JtvCluster.value attribute.

Parameters

  • item - the zero-based item index

Returns

true if this item's attribute matches the current value

newColor()​

Broadcasts the foreground and background components of the current CGA attribute. Called whenever the selected colour changes.

press(int item)​

Overrides:

press(int item) in org.viktor44.jtvision.dialogs.JtvCluster

Applies the CGA attribute for item item and broadcasts the colour change.

Parameters

  • item - the zero-based item index that was pressed

movedTo(int item)​

Overrides:

movedTo(int item) in org.viktor44.jtvision.dialogs.JtvCluster

Applies the CGA attribute for item item when the cursor moves to it, and broadcasts the colour change.

Parameters

  • item - the zero-based item index now under the cursor