*
* The MIT License (MIT)
*
- * Copyright (C) 2017 Kevin Lamonte
+ * Copyright (C) 2019 Kevin Lamonte
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* @return color associated with name, e.g. bold yellow on blue
*/
public CellAttributes getColor(final String name) {
- CellAttributes attr = (CellAttributes) colors.get(name);
+ CellAttributes attr = colors.get(name);
return attr;
}
try {
foreColorRGB = Integer.parseInt(tokenizer.nextToken(), 16);
} catch (NumberFormatException e) {
- e.printStackTrace();
+ // Default to white on black
+ foreColorRGB = 0xFFFFFF;
}
// "on"
try {
backColorRGB = Integer.parseInt(tokenizer.nextToken(), 16);
} catch (NumberFormatException e) {
- e.printStackTrace();
+ backColorRGB = 0;
}
CellAttributes color = new CellAttributes();
return;
}
- while (token.equals("bold") || token.equals("blink")) {
- if (token.equals("bold")) {
+ while (token.equals("bold")
+ || token.equals("bright")
+ || token.equals("blink")
+ ) {
+ if (token.equals("bold") || token.equals("bright")) {
bold = true;
token = tokenizer.nextToken();
}
// Invalid line.
continue;
}
- String key = line.substring(0, line.indexOf(':')).trim();
- String text = line.substring(line.indexOf(':') + 1);
+ String key = line.substring(0, line.indexOf('=')).trim();
+ String text = line.substring(line.indexOf('=') + 1);
setColorFromString(key, text);
}
// All done.
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();
// TField text
color = new CellAttributes();
- color.setForeColor(Color.WHITE);
- color.setBackColor(Color.BLUE);
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.WHITE);
color.setBold(false);
colors.put("tfield.inactive", color);
color = new CellAttributes();
- color.setForeColor(Color.YELLOW);
- color.setBackColor(Color.BLACK);
- color.setBold(true);
+ color.setForeColor(Color.BLACK);
+ color.setBackColor(Color.CYAN);
+ color.setBold(false);
colors.put("tfield.active", color);
// TCheckBox
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.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.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);
}