use of java.awt.Color in project Contrast-Finder by Asqatasun.
the class ColorFinderHsvTest method testFindColorsBornBlack2.
public void testFindColorsBornBlack2() {
System.out.println("FindColorsBornBlack2");
Color foregroundColor = new Color(1, 1, 1);
Color backgroundColor = new Color(3, 3, 3);
Float coefficientLevel = 4.5f;
ColorFinderHsv instance = new ColorFinderHsv();
List<ColorCombinaison> colorCombinaison = new ArrayList<ColorCombinaison>();
instance.findColors(foregroundColor, backgroundColor, false, coefficientLevel);
for (ColorCombinaison combinaisons : instance.getColorResult().getSuggestedColors()) {
LOGGER.debug("HashCode :" + colorCombinaison.hashCode() + " COLOR : " + combinaisons.getContrast());
colorCombinaison.add(combinaisons);
}
Color firstColor = new Color(131, 131, 131);
assertEquals(firstColor, colorCombinaison.get(0).getColor());
}
use of java.awt.Color in project Contrast-Finder by Asqatasun.
the class ColorFinderHsvTest method testFindColorsBornBlack.
public void testFindColorsBornBlack() {
System.out.println("FindColorsBornBlack");
Color foregroundColor = new Color(1, 1, 1);
Color backgroundColor = new Color(3, 3, 3);
Float coefficientLevel = 4.5f;
ColorFinderHsv instance = new ColorFinderHsv();
List<ColorCombinaison> colorCombinaison = new ArrayList<ColorCombinaison>();
instance.findColors(foregroundColor, backgroundColor, true, coefficientLevel);
for (ColorCombinaison combinaisons : instance.getColorResult().getSuggestedColors()) {
LOGGER.debug("HashCode :" + colorCombinaison.hashCode() + " COLOR : " + combinaisons.getContrast());
colorCombinaison.add(combinaisons);
}
Color firstColor = new Color(133, 133, 133);
assertEquals(firstColor, colorCombinaison.get(0).getColor());
}
use of java.awt.Color in project ACS by ACS-Community.
the class ColoredEditorSupport method paintValue.
/**
* a static version of the paintValue method that can be called from other places
* @param graphics the graphics on which to drow
* @param rectangle the rectangle to fill
* @param text the text to display
*/
public static void paintValue(Graphics g, Rectangle rectangle, String text, Color backGround, Color foreGround) {
Color origColor = g.getColor();
// change background color only if the parameter backGround is non-null
if (backGround != null) {
g.setColor(backGround);
}
g.fillRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
// draw the text
int xOffset = 6;
if (foreGround != null) {
g.setColor(foreGround);
} else {
g.setColor(Color.black);
}
FontMetrics fm = g.getFontMetrics();
g.drawString(text, rectangle.x + xOffset, rectangle.y + (rectangle.height - fm.getHeight()) / 2 + fm.getAscent());
// restore color
g.setColor(origColor);
}
use of java.awt.Color in project ACS by ACS-Community.
the class LogManagerGui method colorFromLevel.
////////////////////////////////////////////////////////
/// ----------------- Internal --------------------- ///
////////////////////////////////////////////////////////
Color colorFromLevel(Level x) {
Color ret = (Color) level2color.get(x);
if (ret == null) {
ret = Color.magenta;
message("no color defined for log-level " + x);
}
return ret;
}
use of java.awt.Color in project tomcat by apache.
the class Clock2 method init.
@Override
public void init() {
lastxs = lastys = lastxm = lastym = lastxh = lastyh = 0;
formatter = new SimpleDateFormat("EEE MMM dd hh:mm:ss yyyy", Locale.getDefault());
currentDate = new Date();
lastdate = formatter.format(currentDate);
clockFaceFont = new Font("Serif", Font.PLAIN, 14);
handColor = Color.blue;
numberColor = Color.darkGray;
try {
setBackground(new Color(Integer.parseInt(getParameter("bgcolor"), 16)));
} catch (Exception e) {
// Ignored
}
try {
handColor = new Color(Integer.parseInt(getParameter("fgcolor1"), 16));
} catch (Exception e) {
// Ignored
}
try {
numberColor = new Color(Integer.parseInt(getParameter("fgcolor2"), 16));
} catch (Exception e) {
// Ignored
}
// Set clock window size
resize(300, 300);
}
Aggregations