X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fbits%2FColorTheme.java;h=3efce633243c9f82433d0212ad13e6caefe4922c;hb=bd743ca20c648a0c195dcd0650a3b2c5600b7833;hp=ff78af454d5744e34eb3c5f6173e0f00b7a56e14;hpb=2420f903afc54a5bcf61f1bdd5e3dfada2fab5b2;p=fanfix.git
diff --git a/src/jexer/bits/ColorTheme.java b/src/jexer/bits/ColorTheme.java
index ff78af4..3efce63 100644
--- a/src/jexer/bits/ColorTheme.java
+++ b/src/jexer/bits/ColorTheme.java
@@ -1,34 +1,30 @@
-/**
+/*
* Jexer - Java Text User Interface
*
- * Version: $Id$
- *
- * Author: Kevin Lamonte, kevin.lamonte@gmail.com
+ * The MIT License (MIT)
*
- * License: LGPLv3 or later
+ * Copyright (C) 2019 Kevin Lamonte
*
- * Copyright: This module is licensed under the GNU Lesser General
- * Public License Version 3. Please see the file "COPYING" in this
- * directory for more information about the GNU Lesser General Public
- * License Version 3.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
- * Copyright (C) 2015 Kevin Lamonte
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see
- * http://www.gnu.org/licenses/, or write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
+ * @author Kevin Lamonte [kevin.lamonte@gmail.com]
+ * @version 1
*/
package jexer.bits;
@@ -36,387 +32,707 @@ import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
import java.util.SortedMap;
import java.util.StringTokenizer;
import java.util.TreeMap;
/**
- * ColorTheme is a collection of colors keyed by string.
+ * ColorTheme is a collection of colors keyed by string. A default theme is
+ * also provided that matches the blue-and-white theme used by Turbo Vision.
*/
public class ColorTheme {
+ // ------------------------------------------------------------------------
+ // Variables --------------------------------------------------------------
+ // ------------------------------------------------------------------------
+
/**
- * The current theme colors
+ * The current theme colors.
*/
private SortedMap colors;
+ // ------------------------------------------------------------------------
+ // Constructors -----------------------------------------------------------
+ // ------------------------------------------------------------------------
+
/**
- * Public constructor.
+ * Public constructor sets the theme to the default.
*/
public ColorTheme() {
- colors = new TreeMap();
- setDefaultTheme();
+ colors = new TreeMap();
+ setDefaultTheme();
+ }
+
+ // ------------------------------------------------------------------------
+ // ColorTheme -------------------------------------------------------------
+ // ------------------------------------------------------------------------
+
+ /**
+ * Retrieve the CellAttributes for a named theme color.
+ *
+ * @param name theme color name, e.g. "twindow.border"
+ * @return color associated with name, e.g. bold yellow on blue
+ */
+ public CellAttributes getColor(final String name) {
+ CellAttributes attr = colors.get(name);
+ return attr;
+ }
+
+ /**
+ * Retrieve all the names in the theme.
+ *
+ * @return a list of names
+ */
+ public List getColorNames() {
+ Set keys = colors.keySet();
+ List names = new ArrayList(keys.size());
+ names.addAll(keys);
+ return names;
}
/**
- * Retrieve the CellAttributes by name.
+ * Set the color for a named theme color.
*
- * @param name hash key
- * @return color associated with hash key
+ * @param name theme color name, e.g. "twindow.border"
+ * @param color the new color to associate with name, e.g. bold yellow on
+ * blue
*/
- public CellAttributes getColor(String name) {
- CellAttributes attr = (CellAttributes)colors.get(name);
- return attr;
+ public void setColor(final String name, final CellAttributes color) {
+ colors.put(name, color);
}
/**
- * Save the colors to an ASCII file
+ * Save the color theme mappings to an ASCII file.
*
* @param filename file to write to
+ * @throws IOException if the I/O fails
*/
- public void save(String filename) throws IOException {
- FileWriter file = new FileWriter(filename);
- for (String key: colors.keySet()) {
- CellAttributes color = getColor(key);
- file.write(String.format("%s = %s\n", key, color));
- }
- file.close();
+ public void save(final String filename) throws IOException {
+ FileWriter file = new FileWriter(filename);
+ for (String key: colors.keySet()) {
+ CellAttributes color = getColor(key);
+ file.write(String.format("%s = %s\n", key, color));
+ }
+ file.close();
}
/**
- * Read colors from an ASCII file
+ * Read color theme mappings from an ASCII file.
*
* @param filename file to read from
+ * @throws IOException if the I/O fails
*/
- public void load(String filename) throws IOException {
- BufferedReader reader = new BufferedReader(new FileReader(filename));
- String line = reader.readLine();
- for (; line != null; line = reader.readLine()) {
- String key;
- String bold;
- String foreColor;
- String backColor;
-
- // Look for lines that resemble:
- // "key = blah on blah"
- // "key = bold blah on blah"
- StringTokenizer tokenizer = new StringTokenizer(line);
- key = tokenizer.nextToken();
- if (!tokenizer.nextToken().equals("=")) {
- // Skip this line
- continue;
- }
- bold = tokenizer.nextToken();
- if (!bold.toLowerCase().equals("bold")) {
- // "key = blah on blah"
- foreColor = bold;
- } else {
- // "key = bold blah on blah"
- foreColor = tokenizer.nextToken().toLowerCase();
- }
- if (!tokenizer.nextToken().toLowerCase().equals("on")) {
- // Skip this line
- continue;
- }
- backColor = tokenizer.nextToken().toLowerCase();
-
- CellAttributes color = new CellAttributes();
- if (bold.equals("bold")) {
- color.bold = true;
- }
- color.foreColor = CellAttributes.colorFromString(foreColor);
- color.backColor = CellAttributes.colorFromString(backColor);
- colors.put(key, color);
- }
+ public void load(final String filename) throws IOException {
+ load(new FileReader(filename));
+ }
+
+ /**
+ * Set a color based on a text string. Color text string is of the form:
+ * [ bold ] [ blink ] { foreground on background }
+ *
+ * @param key the color key string
+ * @param text the text string
+ */
+ public void setColorFromString(final String key, final String text) {
+ boolean bold = false;
+ boolean blink = false;
+ String foreColor;
+ String backColor;
+ String token;
+
+ StringTokenizer tokenizer = new StringTokenizer(text);
+ token = tokenizer.nextToken();
+
+ if (token.toLowerCase().equals("rgb:")) {
+ // Foreground
+ int foreColorRGB = -1;
+ try {
+ foreColorRGB = Integer.parseInt(tokenizer.nextToken(), 16);
+ } catch (NumberFormatException e) {
+ // Default to white on black
+ foreColorRGB = 0xFFFFFF;
+ }
+
+ // "on"
+ if (!tokenizer.nextToken().toLowerCase().equals("on")) {
+ // Invalid line.
+ return;
+ }
+
+ // Background
+ int backColorRGB = -1;
+ try {
+ backColorRGB = Integer.parseInt(tokenizer.nextToken(), 16);
+ } catch (NumberFormatException e) {
+ backColorRGB = 0;
+ }
+
+ CellAttributes color = new CellAttributes();
+ color.setForeColorRGB(foreColorRGB);
+ color.setBackColorRGB(backColorRGB);
+ colors.put(key, color);
+ return;
+ }
+
+ while (token.equals("bold")
+ || token.equals("bright")
+ || token.equals("blink")
+ ) {
+ if (token.equals("bold") || token.equals("bright")) {
+ bold = true;
+ token = tokenizer.nextToken();
+ }
+ if (token.equals("blink")) {
+ blink = true;
+ token = tokenizer.nextToken();
+ }
+ }
+
+ // What's left is "blah on blah"
+ foreColor = token.toLowerCase();
+
+ if (!tokenizer.nextToken().toLowerCase().equals("on")) {
+ // Invalid line.
+ return;
+ }
+ backColor = tokenizer.nextToken().toLowerCase();
+
+ CellAttributes color = new CellAttributes();
+ if (bold) {
+ color.setBold(true);
+ }
+ if (blink) {
+ color.setBlink(true);
+ }
+ color.setForeColor(Color.getColor(foreColor));
+ color.setBackColor(Color.getColor(backColor));
+ colors.put(key, color);
+ }
+
+ /**
+ * Read color theme mappings from a Reader. The reader is closed at the
+ * end.
+ *
+ * @param reader the reader to read from
+ * @throws IOException if the I/O fails
+ */
+ public void load(final Reader reader) throws IOException {
+ BufferedReader bufferedReader = new BufferedReader(reader);
+ String line = bufferedReader.readLine();
+ for (; line != null; line = bufferedReader.readLine()) {
+ // Look for lines that resemble:
+ // "key = blah on blah"
+ // "key = bold blah on blah"
+ // "key = blink bold blah on blah"
+ // "key = bold blink blah on blah"
+ // "key = blink blah on blah"
+ if (line.indexOf('=') == -1) {
+ // Invalid line.
+ continue;
+ }
+ String key = line.substring(0, line.indexOf('=')).trim();
+ String text = line.substring(line.indexOf('=') + 1);
+ setColorFromString(key, text);
+ }
+ // All done.
+ bufferedReader.close();
}
/**
* Sets to defaults that resemble the Borland IDE colors.
*/
public void setDefaultTheme() {
- CellAttributes color;
-
- // TWindow border
- color = new CellAttributes();
- color.foreColor = Color.WHITE;
- color.backColor = Color.BLUE;
- color.bold = true;
- colors.put("twindow.border", color);
-
- // TWindow background
- color = new CellAttributes();
- color.foreColor = Color.YELLOW;
- color.backColor = Color.BLUE;
- color.bold = true;
- colors.put("twindow.background", color);
-
- // TWindow border - inactive
- color = new CellAttributes();
- color.foreColor = Color.BLACK;
- color.backColor = Color.BLUE;
- color.bold = true;
- colors.put("twindow.border.inactive", color);
-
- // TWindow background - inactive
- color = new CellAttributes();
- color.foreColor = Color.YELLOW;
- color.backColor = Color.BLUE;
- color.bold = true;
- colors.put("twindow.background.inactive", color);
-
- // TWindow border - modal
- color = new CellAttributes();
- color.foreColor = Color.WHITE;
- color.backColor = Color.WHITE;
- color.bold = true;
- colors.put("twindow.border.modal", color);
-
- // TWindow background - modal
- color = new CellAttributes();
- color.foreColor = Color.BLACK;
- color.backColor = Color.WHITE;
- color.bold = false;
- colors.put("twindow.background.modal", color);
-
- // TWindow border - modal + inactive
- color = new CellAttributes();
- color.foreColor = Color.BLACK;
- color.backColor = Color.WHITE;
- color.bold = true;
- colors.put("twindow.border.modal.inactive", color);
-
- // TWindow background - modal + inactive
- color = new CellAttributes();
- color.foreColor = Color.BLACK;
- color.backColor = Color.WHITE;
- color.bold = false;
- colors.put("twindow.background.modal.inactive", color);
-
- // TWindow border - during window movement - modal
- color = new CellAttributes();
- color.foreColor = Color.GREEN;
- color.backColor = Color.WHITE;
- color.bold = true;
- colors.put("twindow.border.modal.windowmove", color);
-
- // TWindow border - during window movement
- color = new CellAttributes();
- color.foreColor = Color.GREEN;
- color.backColor = Color.BLUE;
- color.bold = true;
- colors.put("twindow.border.windowmove", color);
-
- // TWindow background - during window movement
- color = new CellAttributes();
- color.foreColor = Color.YELLOW;
- color.backColor = Color.BLUE;
- color.bold = false;
- colors.put("twindow.background.windowmove", color);
-
- // TApplication background
- color = new CellAttributes();
- color.foreColor = Color.BLUE;
- color.backColor = Color.WHITE;
- color.bold = false;
- colors.put("tapplication.background", color);
-
- // TButton text
- color = new CellAttributes();
- color.foreColor = Color.BLACK;
- color.backColor = Color.GREEN;
- color.bold = false;
- colors.put("tbutton.inactive", color);
- color = new CellAttributes();
- color.foreColor = Color.WHITE;
- color.backColor = Color.GREEN;
- color.bold = true;
- colors.put("tbutton.active", color);
- color = new CellAttributes();
- color.foreColor = Color.BLACK;
- color.backColor = Color.WHITE;
- color.bold = true;
- colors.put("tbutton.disabled", color);
- color = new CellAttributes();
- color.foreColor = Color.YELLOW;
- color.backColor = Color.GREEN;
- color.bold = true;
- colors.put("tbutton.mnemonic", color);
- color = new CellAttributes();
- color.foreColor = Color.YELLOW;
- color.backColor = Color.GREEN;
- color.bold = true;
- colors.put("tbutton.mnemonic.highlighted", color);
-
- // TLabel text
- color = new CellAttributes();
- color.foreColor = Color.WHITE;
- color.backColor = Color.BLUE;
- color.bold = true;
- colors.put("tlabel", color);
-
- // TText text
- color = new CellAttributes();
- color.foreColor = Color.WHITE;
- color.backColor = Color.BLACK;
- color.bold = false;
- colors.put("ttext", color);
-
- // TField text
- color = new CellAttributes();
- color.foreColor = Color.WHITE;
- color.backColor = Color.BLUE;
- color.bold = false;
- colors.put("tfield.inactive", color);
- color = new CellAttributes();
- color.foreColor = Color.YELLOW;
- color.backColor = Color.BLACK;
- color.bold = true;
- colors.put("tfield.active", color);
-
- // TCheckbox
- color = new CellAttributes();
- color.foreColor = Color.WHITE;
- color.backColor = Color.BLUE;
- color.bold = false;
- colors.put("tcheckbox.inactive", color);
- color = new CellAttributes();
- color.foreColor = Color.YELLOW;
- color.backColor = Color.BLACK;
- color.bold = true;
- colors.put("tcheckbox.active", color);
-
-
- // TRadioButton
- color = new CellAttributes();
- color.foreColor = Color.WHITE;
- color.backColor = Color.BLUE;
- color.bold = false;
- colors.put("tradiobutton.inactive", color);
- color = new CellAttributes();
- color.foreColor = Color.YELLOW;
- color.backColor = Color.BLACK;
- color.bold = true;
- colors.put("tradiobutton.active", color);
-
- // TRadioGroup
- color = new CellAttributes();
- color.foreColor = Color.WHITE;
- color.backColor = Color.BLUE;
- color.bold = false;
- colors.put("tradiogroup.inactive", color);
- color = new CellAttributes();
- color.foreColor = Color.YELLOW;
- color.backColor = Color.BLUE;
- color.bold = true;
- colors.put("tradiogroup.active", color);
-
- // TMenu
- color = new CellAttributes();
- color.foreColor = Color.BLACK;
- color.backColor = Color.WHITE;
- color.bold = false;
- colors.put("tmenu", color);
- color = new CellAttributes();
- color.foreColor = Color.BLACK;
- color.backColor = Color.GREEN;
- color.bold = false;
- colors.put("tmenu.highlighted", color);
- color = new CellAttributes();
- color.foreColor = Color.RED;
- color.backColor = Color.WHITE;
- color.bold = false;
- colors.put("tmenu.mnemonic", color);
- color = new CellAttributes();
- color.foreColor = Color.RED;
- color.backColor = Color.GREEN;
- color.bold = false;
- colors.put("tmenu.mnemonic.highlighted", color);
- color = new CellAttributes();
- color.foreColor = Color.BLACK;
- color.backColor = Color.WHITE;
- color.bold = true;
- colors.put("tmenu.disabled", color);
-
- // TProgressBar
- color = new CellAttributes();
- color.foreColor = Color.BLUE;
- color.backColor = Color.BLUE;
- color.bold = true;
- colors.put("tprogressbar.complete", color);
- color = new CellAttributes();
- color.foreColor = Color.WHITE;
- color.backColor = Color.BLUE;
- color.bold = false;
- colors.put("tprogressbar.incomplete", color);
-
- // THScroller / TVScroller
- color = new CellAttributes();
- color.foreColor = Color.CYAN;
- color.backColor = Color.BLUE;
- color.bold = false;
- colors.put("tscroller.bar", color);
- color = new CellAttributes();
- color.foreColor = Color.BLUE;
- color.backColor = Color.CYAN;
- color.bold = false;
- colors.put("tscroller.arrows", color);
-
- // TTreeView
- color = new CellAttributes();
- color.foreColor = Color.WHITE;
- color.backColor = Color.BLUE;
- color.bold = false;
- colors.put("ttreeview", color);
- color = new CellAttributes();
- color.foreColor = Color.GREEN;
- color.backColor = Color.BLUE;
- color.bold = true;
- colors.put("ttreeview.expandbutton", color);
- color = new CellAttributes();
- color.foreColor = Color.BLACK;
- color.backColor = Color.CYAN;
- color.bold = false;
- colors.put("ttreeview.selected", color);
- color = new CellAttributes();
- color.foreColor = Color.RED;
- color.backColor = Color.BLUE;
- color.bold = false;
- colors.put("ttreeview.unreadable", color);
- color = new CellAttributes();
- color.foreColor = Color.BLACK;
- color.backColor = Color.BLUE;
- color.bold = true;
- colors.put("ttreeview.inactive", color);
-
- // TText text
- color = new CellAttributes();
- color.foreColor = Color.WHITE;
- color.backColor = Color.BLUE;
- color.bold = false;
- colors.put("tdirectorylist", color);
- color = new CellAttributes();
- color.foreColor = Color.BLACK;
- color.backColor = Color.CYAN;
- color.bold = false;
- colors.put("tdirectorylist.selected", color);
- color = new CellAttributes();
- color.foreColor = Color.BLACK;
- color.backColor = Color.CYAN;
- color.bold = false;
- colors.put("tdirectorylist.unreadable", color);
- color = new CellAttributes();
- color.foreColor = Color.BLACK;
- color.backColor = Color.BLUE;
- color.bold = true;
- colors.put("tdirectorylist.inactive", color);
-
- // TEditor
- color = new CellAttributes();
- color.foreColor = Color.WHITE;
- color.backColor = Color.BLACK;
- color.bold = false;
- colors.put("teditor", color);
+ CellAttributes color;
+
+ // TWindow border
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(true);
+ colors.put("twindow.border", color);
+
+ // TWindow background
+ color = new CellAttributes();
+ color.setForeColor(Color.YELLOW);
+ color.setBackColor(Color.BLUE);
+ color.setBold(true);
+ colors.put("twindow.background", color);
+
+ // TWindow border - inactive
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.BLUE);
+ color.setBold(true);
+ colors.put("twindow.border.inactive", color);
+
+ // TWindow background - inactive
+ color = new CellAttributes();
+ color.setForeColor(Color.YELLOW);
+ color.setBackColor(Color.BLUE);
+ color.setBold(true);
+ colors.put("twindow.background.inactive", color);
+
+ // TWindow border - modal
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.WHITE);
+ color.setBold(true);
+ colors.put("twindow.border.modal", color);
+
+ // TWindow background - modal
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.WHITE);
+ color.setBold(false);
+ colors.put("twindow.background.modal", color);
+
+ // TWindow border - modal + inactive
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.WHITE);
+ color.setBold(true);
+ colors.put("twindow.border.modal.inactive", color);
+
+ // TWindow background - modal + inactive
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.WHITE);
+ color.setBold(false);
+ colors.put("twindow.background.modal.inactive", color);
+
+ // TWindow border - during window movement - modal
+ color = new CellAttributes();
+ color.setForeColor(Color.GREEN);
+ color.setBackColor(Color.WHITE);
+ color.setBold(true);
+ colors.put("twindow.border.modal.windowmove", color);
+
+ // TWindow border - during window movement
+ color = new CellAttributes();
+ color.setForeColor(Color.GREEN);
+ color.setBackColor(Color.BLUE);
+ color.setBold(true);
+ colors.put("twindow.border.windowmove", color);
+
+ // TWindow background - during window movement
+ color = new CellAttributes();
+ color.setForeColor(Color.YELLOW);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("twindow.background.windowmove", color);
+
+ // TDesktop background
+ color = new CellAttributes();
+ color.setForeColor(Color.BLUE);
+ color.setBackColor(Color.WHITE);
+ color.setBold(false);
+ colors.put("tdesktop.background", color);
+
+ // TButton text
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.GREEN);
+ color.setBold(false);
+ colors.put("tbutton.inactive", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.CYAN);
+ color.setBackColor(Color.GREEN);
+ color.setBold(true);
+ colors.put("tbutton.active", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.WHITE);
+ color.setBold(true);
+ colors.put("tbutton.disabled", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.YELLOW);
+ color.setBackColor(Color.GREEN);
+ color.setBold(true);
+ colors.put("tbutton.mnemonic", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.YELLOW);
+ color.setBackColor(Color.GREEN);
+ color.setBold(true);
+ colors.put("tbutton.mnemonic.highlighted", color);
+
+ // TLabel text
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(true);
+ colors.put("tlabel", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.YELLOW);
+ color.setBackColor(Color.BLUE);
+ color.setBold(true);
+ colors.put("tlabel.mnemonic", color);
+
+ // TText text
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("ttext", color);
+
+ // TField text
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.WHITE);
+ color.setBold(false);
+ colors.put("tfield.inactive", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.CYAN);
+ color.setBold(false);
+ colors.put("tfield.active", color);
+
+ // TCheckBox
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("tcheckbox.inactive", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.YELLOW);
+ color.setBackColor(Color.BLACK);
+ color.setBold(true);
+ colors.put("tcheckbox.active", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.YELLOW);
+ color.setBackColor(Color.BLUE);
+ color.setBold(true);
+ colors.put("tcheckbox.mnemonic", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.RED);
+ color.setBackColor(Color.BLACK);
+ color.setBold(true);
+ colors.put("tcheckbox.mnemonic.highlighted", color);
+
+ // TComboBox
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.WHITE);
+ color.setBold(false);
+ colors.put("tcombobox.inactive", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.BLUE);
+ color.setBackColor(Color.CYAN);
+ color.setBold(false);
+ colors.put("tcombobox.active", color);
+
+ // TSpinner
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.WHITE);
+ color.setBold(false);
+ colors.put("tspinner.inactive", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.BLUE);
+ color.setBackColor(Color.CYAN);
+ color.setBold(false);
+ colors.put("tspinner.active", color);
+
+ // TCalendar
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("tcalendar.background", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("tcalendar.day", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.RED);
+ color.setBackColor(Color.WHITE);
+ color.setBold(false);
+ colors.put("tcalendar.day.selected", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.BLUE);
+ color.setBackColor(Color.CYAN);
+ color.setBold(false);
+ colors.put("tcalendar.arrow", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(true);
+ colors.put("tcalendar.title", color);
+
+ // TRadioButton
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("tradiobutton.inactive", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.YELLOW);
+ color.setBackColor(Color.BLACK);
+ color.setBold(true);
+ colors.put("tradiobutton.active", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.YELLOW);
+ color.setBackColor(Color.BLUE);
+ color.setBold(true);
+ colors.put("tradiobutton.mnemonic", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.RED);
+ color.setBackColor(Color.BLACK);
+ color.setBold(true);
+ colors.put("tradiobutton.mnemonic.highlighted", color);
+
+ // TRadioGroup
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("tradiogroup.inactive", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.YELLOW);
+ color.setBackColor(Color.BLUE);
+ color.setBold(true);
+ colors.put("tradiogroup.active", color);
+
+ // TMenu
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.WHITE);
+ color.setBold(false);
+ colors.put("tmenu", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.GREEN);
+ color.setBold(false);
+ colors.put("tmenu.highlighted", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.RED);
+ color.setBackColor(Color.WHITE);
+ color.setBold(false);
+ colors.put("tmenu.mnemonic", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.RED);
+ color.setBackColor(Color.GREEN);
+ color.setBold(false);
+ colors.put("tmenu.mnemonic.highlighted", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.WHITE);
+ color.setBold(true);
+ colors.put("tmenu.disabled", color);
+
+ // TProgressBar
+ color = new CellAttributes();
+ color.setForeColor(Color.BLUE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(true);
+ colors.put("tprogressbar.complete", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("tprogressbar.incomplete", color);
+
+ // THScroller / TVScroller
+ color = new CellAttributes();
+ color.setForeColor(Color.CYAN);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("tscroller.bar", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.BLUE);
+ color.setBackColor(Color.CYAN);
+ color.setBold(false);
+ colors.put("tscroller.arrows", color);
+
+ // TTreeView
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("ttreeview", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.GREEN);
+ color.setBackColor(Color.BLUE);
+ color.setBold(true);
+ colors.put("ttreeview.expandbutton", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.CYAN);
+ color.setBold(false);
+ colors.put("ttreeview.selected", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.RED);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("ttreeview.unreadable", color);
+ color = new CellAttributes();
+ // color.setForeColor(Color.BLACK);
+ // color.setBackColor(Color.BLUE);
+ // color.setBold(true);
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("ttreeview.inactive", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.WHITE);
+ color.setBold(false);
+ colors.put("ttreeview.selected.inactive", color);
+
+ // TList
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("tlist", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.CYAN);
+ color.setBold(false);
+ colors.put("tlist.selected", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.CYAN);
+ color.setBold(false);
+ colors.put("tlist.unreadable", color);
+ color = new CellAttributes();
+ // color.setForeColor(Color.BLACK);
+ // color.setBackColor(Color.BLUE);
+ // color.setBold(true);
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("tlist.inactive", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.WHITE);
+ color.setBold(false);
+ colors.put("tlist.selected.inactive", color);
+
+ // TStatusBar
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.WHITE);
+ color.setBold(false);
+ colors.put("tstatusbar.text", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.RED);
+ color.setBackColor(Color.WHITE);
+ color.setBold(false);
+ colors.put("tstatusbar.button", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("tstatusbar.selected", color);
+
+ // TEditor
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("teditor", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.CYAN);
+ color.setBold(false);
+ colors.put("teditor.selected", color);
+
+ // TTable
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("ttable.inactive", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.CYAN);
+ color.setBold(false);
+ colors.put("ttable.active", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.YELLOW);
+ color.setBackColor(Color.CYAN);
+ color.setBold(true);
+ colors.put("ttable.selected", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.WHITE);
+ color.setBold(false);
+ colors.put("ttable.label", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.BLUE);
+ color.setBackColor(Color.WHITE);
+ color.setBold(false);
+ colors.put("ttable.label.selected", color);
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("ttable.border", color);
+
+ // TSplitPane
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("tsplitpane", color);
+
+ // THelpWindow border - during window movement
+ color = new CellAttributes();
+ color.setForeColor(Color.GREEN);
+ color.setBackColor(Color.CYAN);
+ color.setBold(true);
+ colors.put("thelpwindow.windowmove", color);
+
+ // THelpWindow border
+ color = new CellAttributes();
+ color.setForeColor(Color.GREEN);
+ color.setBackColor(Color.CYAN);
+ color.setBold(true);
+ colors.put("thelpwindow.border", color);
+
+ // THelpWindow background
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.CYAN);
+ color.setBold(true);
+ colors.put("thelpwindow.background", color);
+
+ // THelpWindow text
+ color = new CellAttributes();
+ color.setForeColor(Color.WHITE);
+ color.setBackColor(Color.BLUE);
+ color.setBold(false);
+ colors.put("thelpwindow.text", color);
+
+ // THelpWindow link
+ color = new CellAttributes();
+ color.setForeColor(Color.YELLOW);
+ color.setBackColor(Color.BLUE);
+ color.setBold(true);
+ colors.put("thelpwindow.link", color);
+
+ // THelpWindow link - active
+ color = new CellAttributes();
+ color.setForeColor(Color.YELLOW);
+ color.setBackColor(Color.CYAN);
+ color.setBold(true);
+ colors.put("thelpwindow.link.active", color);
+
+ }
+ /**
+ * Make human-readable description of this Cell.
+ *
+ * @return displayable String
+ */
+ @Override
+ public String toString() {
+ return colors.toString();
}
}