import jalview.schemes.ColourSchemeI;
import jalview.schemes.ResidueProperties;
import jalview.schemes.UserColourScheme;
+import jalview.util.ColorUtils;
import jalview.util.MessageManager;
import java.awt.Color;
{
button = (JButton) selectedButtons.elementAt(i);
button.setBackground(newColour);
- button.setForeground(brighterThan(newColour));
+ button.setForeground(ColorUtils.brighterThan(newColour));
}
if (button == lcaseColour)
{
{
button = (JButton) lowerCaseButtons.elementAt(i);
button.setBackground(newColour);
- button.setForeground(brighterThan(button.getBackground()));
+ button.setForeground(ColorUtils.brighterThan(button.getBackground()));
}
}
}
JButton button = (JButton) buttonPanel.getComponent(b);
if (!selectedButtons.contains(button))
{
- button.setForeground(brighterThan(button.getBackground()));
+ button.setForeground(ColorUtils.brighterThan(button.getBackground()));
selectedButtons.add(button);
}
}
for (int b = 0; b < selectedButtons.size(); b++)
{
JButton button = (JButton) selectedButtons.elementAt(b);
- button.setForeground(darkerThan(button.getBackground()));
+ button.setForeground(ColorUtils.darkerThan(button.getBackground()));
}
selectedButtons.clear();
- pressed.setForeground(brighterThan(pressed.getBackground()));
+ pressed.setForeground(ColorUtils.brighterThan(pressed.getBackground()));
selectedButtons.addElement(pressed);
}
{
if (selectedButtons.contains(pressed))
{
- pressed.setForeground(darkerThan(pressed.getBackground()));
+ pressed.setForeground(ColorUtils.darkerThan(pressed.getBackground()));
selectedButtons.remove(pressed);
}
else
{
- pressed.setForeground(brighterThan(pressed.getBackground()));
+ pressed.setForeground(ColorUtils.brighterThan(pressed.getBackground()));
selectedButtons.addElement(pressed);
}
}
button.setOpaque(true); // required for the next line to have effect
button.setBackground(col);
button.setText(label);
- button.setForeground(darkerThan(col));
+ button.setForeground(ColorUtils.darkerThan(col));
button.setFont(new java.awt.Font("Verdana", Font.BOLD, 10));
return button;
}
/**
- * Returns a colour three shades darker.
- *
- * We use darker text to indicate unselected buttons, lighter text for selected.
- * @param col
- * @return
- */
- public static Color darkerThan(Color col) {
- return col.darker().darker().darker();
- }
-
- /**
- * Returns a colour three shades brighter.
- *
- * We use darker text to indicate unselected buttons, lighter text for selected.
- * @param col
- * @return
- */
- public static Color brighterThan(Color col) {
- return col.brighter().brighter().brighter();
- }
-
- /**
* DOCUMENT ME!
*
* @param e
}
+/**
+ * Returns a colour three shades darker.
+ *
+ * We use darker text to indicate unselected buttons, lighter text for selected. Note you can't
+ * guarantee that darkerThan/brighterThan undo each other, as they may result in black/white.
+ *
+ * @param col
+ * @return
+ */
+ public static Color darkerThan(Color col) {
+ return col.darker().darker().darker();
+ }
+
+/**
+ * Returns a colour three shades brighter.
+ *
+ * We use darker text to indicate unselected buttons, lighter text for selected. Note you can't
+ * guarantee that darkerThan/brighterThan undo each other, as they may result in black/white.
+ * @param col
+ * @return
+ */
+ public static Color brighterThan(Color col) {
+ return col.brighter().brighter().brighter();
+ }
+
}