public final class ColourMask
extends java.lang.Object
Colour mask support file
The file contains many methods and constants for colour mask support in SequenceTextArea objects. The methods and constants are outlined below:
To read in colour masks, use EITHER of the below class methods:
DON'T USE THE CONSTRUCTOR DIRECTLY FROM OUTSIDE THIS CLASS!!!
The two main types of colour masks:
Character based colour format specification
The character based file format parsed by this class is the BioLegato character based colour mask format. It is defined as follows:
An example of the above format:
aa colour
abc #FFFFFF
k #ACEED0
yz #040404
Modifier and Type | Class and Description |
---|---|
static class |
ColourMask.MaskType
The type of mask defined by the colour mask class
(i.e.
|
Modifier and Type | Field and Description |
---|---|
static javax.swing.filechooser.FileFilter |
CHAR_MASK_FILTER
The colour mask file reader for GDE's position-based colour mask files.
|
static java.awt.Color |
FOREG
The current default FOREG colour of normal unselected text
|
static javax.swing.filechooser.FileFilter |
GDE_MASK_FILTER
The colour mask file reader for BioLegato's
character-based colour mask files.
|
static int |
HASH_SIZE
The functional maximum size of the hashtable.
|
static java.awt.Color[] |
STDCOLOURS
These are the default colours specified in GDE colour mask files.
|
Modifier | Constructor and Description |
---|---|
protected |
ColourMask(ColourMask.MaskType type,
java.lang.String name,
java.awt.Color[] colours)
Creates a new instance of a colour mask
|
Modifier and Type | Method and Description |
---|---|
void |
drawString(java.awt.Graphics gfx,
char[] array,
int offset,
int length,
int xstart,
int ystart)
Draws a character string using the character colour coding specified by
the ColourMask object.
|
static ColourMask |
readCharMaskFile(java.io.File file)
Reads and parses a character colour mask file.
|
static ColourMask |
readPosMaskFile(java.io.File file)
Reads and parses a position colour mask file.
|
java.lang.String |
toString()
Returns the name of the colour mask.
|
public static final java.awt.Color[] STDCOLOURS
These are the default colours specified in GDE colour mask files.
The format of a GDE colour mask file is indicated by numbers, which in this implementation of the format correspond to indices in the hash.
public static final javax.swing.filechooser.FileFilter CHAR_MASK_FILTER
public static final javax.swing.filechooser.FileFilter GDE_MASK_FILTER
public static final java.awt.Color FOREG
public static final int HASH_SIZE
protected ColourMask(ColourMask.MaskType type, java.lang.String name, java.awt.Color[] colours)
type
- the type of the colour mask
(Positional or Character based)name
- the name of the colour mask
(used in comboboxes for human identification)colours
- the array of colours to use in the maskpublic void drawString(java.awt.Graphics gfx, char[] array, int offset, int length, int xstart, int ystart)
gfx
- the Graphics object to draw the text string to.array
- the array of characters to draw in colour.offset
- the offset, within the array, to begin drawing characters.length
- the number of characters, within the array, to draw.xstart
- the X-coordinate to begin drawing characters at.ystart
- the Y-coordinate to begin drawing characters at.public java.lang.String toString()
Returns the name of the colour mask.
This is useful for any comboboxes or other widgets which wish to elicit the name of the colour mask.
toString
in class java.lang.Object
public static ColourMask readCharMaskFile(java.io.File file) throws java.io.IOException
file
- the file to read.java.io.IOException
public static ColourMask readPosMaskFile(java.io.File file) throws java.io.IOException
file
- the file to read.java.io.IOException
Copyright © 2008-2022 University of Manitoba.