public static Color fromObject(Object v) { return fromObject(v, 255); }
return Color.LIGHT_GRAY; } else if (v instanceof Boolean) { return fromBoolean((Boolean) v, alpha); } else if (v instanceof Double) { return fromDouble((Double) v, alpha); } else if (v instanceof Float) { return fromDouble((Float) v, alpha); } else if (v instanceof Byte) { return fromDouble((double) ((Byte) v) / Byte.MAX_VALUE, alpha); } else if (v instanceof Integer) { return fromRGB((Integer) v); } else if (v instanceof Long) { return fromDouble((Long) v, alpha); } else if (v instanceof Matrix) { Matrix m = (Matrix) v; s += " " + m.getLabel(); return fromString(s, alpha); } else { String s = StringUtil.format(v); try { double d = Double.parseDouble(s); return fromDouble(d, alpha); } catch (Exception e) { return fromString(s, alpha);
label.setHorizontalAlignment(JLabel.CENTER); Color c = ColorUtil.fromObject(value); label.setForeground(ColorUtil.contrastBW(c)); if (isSelected) { label.setBorder(borderSelected); label.setBackground(ColorUtil.add(c, SELECTCOLOR)); } else { label.setBorder(borderNotSelected);
Color bg = ColorUtil.fromObject(o); Color fg = ColorUtil.contrastBW(bg); writer.write("<td class=\"text-right\" style=\"color:" + ColorUtil.toHtmlColor(fg) + ";background:" + ColorUtil.toHtmlColor(bg) + "\">"); writer.write(matrix.getAsString(row, col)); writer.write("</td>" + EOL);
s = s.substring(0, 25) + "..."; g2d.setColor(ColorUtil.contrastBW(bg.getColor())); GraphicsUtil.drawString(g2d, width / 2.0, height / 2.0 - 1.0, GraphicsUtil.ALIGNCENTER, GraphicsUtil.ALIGNCENTER, s);
public static Color fromString(String s) { return fromString(s, 255); }
public static final Color fromBoolean(boolean v, int alpha) { Color c = fromBoolean(v); return new Color(c.getRed(), c.getGreen(), c.getBlue(), alpha); }
public static final Color fromDouble(double v, int alpha) { Color c = fromDouble(v); return new Color(c.getRed(), c.getGreen(), c.getBlue(), alpha); }
g2d.setColor(ColorUtil.contrastBW(col)); String s = UJMPFormat.getSingleLineInstance().format(matrixGUIObject.getValueAt(0, 0)); if (s != null && s.length() > 25) {
public Paint transform(T input) { if (pickedState == null) { return ColorUtil.fromObject(input, 100); } else if (pickedState.isPicked(input)) { return UIDefaults.SELECTEDCOLOR; } else { return ColorUtil.fromObject(input, 100); } }
public Paint transform(T input) { if (pickedState == null) { return ColorUtil.fromObject(input, 100); } else if (pickedState.isPicked(input)) { return UIDefaults.SELECTEDCOLOR; } else { return ColorUtil.fromObject(input, 100); } }
public void paintIcon(Component c, Graphics g, int x, int y) { Graphics2D g2d = (Graphics2D) g; if (pickedVertexState.isPicked(v)) { g2d.setColor(UIDefaults.SELECTEDCOLOR); } else { g2d.setColor(ColorUtil.fromObject(v)); } g2d.fillOval(x, y, 10, 10); g2d.setColor(new Color(150, 150, 150, 150)); g2d.drawOval(x, y, 10, 10); } };
public void paintIcon(Component c, Graphics g, int x, int y) { Graphics2D g2d = (Graphics2D) g; if (pickedVertexState.isPicked(v)) { g2d.setColor(UIDefaults.SELECTEDCOLOR); } else { g2d.setColor(ColorUtil.fromObject(v)); } g2d.fillOval(x, y, 10, 10); g2d.setColor(new Color(150, 150, 150, 150)); g2d.drawOval(x, y, 10, 10); } };
c.setBackground(Color.WHITE); } else { c.setBackground(ColorUtil.fromObject(mv));
paintTreeRect(g, subChildCounts, x, y, width, height); } else { g.setColor(ColorUtil.fromObject(s.getObject())); g.fillRect(x + 1, y + 1, width - 1, height - 1); paintTreeRect(g, subChildCounts, x, y, w, height); } else { g.setColor(ColorUtil.fromObject(s.getObject())); g.fillRect(x + 1, y + 1, w - 1, height - 1); paintTreeRect(g, subChildCounts, x, y, width, h); } else { g.setColor(ColorUtil.fromObject(s.getObject())); g.fillRect(x + 1, y + 1, width - 1, h - 1);
public void fireValueChanged(Coordinates coordinates, Object value) { iconUpToDate = false; dataCache.put(coordinates, new DataItem(value, ColorUtil.fromObject(value))); for (final Object o : getListenerList().getListenerList()) { if (o instanceof TableModelListener64) { ((TableModelListener64) o).tableChanged(new TableModelEvent64(this, coordinates.getRow(), coordinates .getRow(), coordinates.getColumn(), TableModelEvent64.UPDATE)); } else if (o instanceof TableModelListener) { ((TableModelListener) o).tableChanged(new TableModelEvent(this, MathUtil.longToInt(coordinates.getRow()), MathUtil.longToInt(coordinates.getRow()), MathUtil .longToInt(coordinates.getColumn()), TableModelEvent.UPDATE)); } } super.fireValueChanged(); }
Object object = matrixGUIObject.getMatrix().getAsObject(coordinates.getLongCoordinates()); matrixGUIObject.getDataCache().put(coordinates, new DataItem(object, ColorUtil.fromObject(object)));