public void draw(Object obj, Component comp, Graphics2D g2, Rectangle rect)
    {
        Color color = (Color) AbstractDisplay.getProperty(obj, "color");
        if (color == null && obj instanceof Color)
            color = (Color) obj;
        Color textColor = (Color) AbstractDisplay.getProperty(obj, "textColor");
        if (textColor == null) textColor = Color.BLACK;
        if (color != null)
        {
            g2.setPaint(color);
            g2.fill(rect);

            if (color.equals(textColor))
            {
                textColor = new Color(
                        255 - textColor.getRed(),
                        255 - textColor.getGreen(), 
                        255 - textColor.getBlue()); 
            }
        }
        String text = (String) AbstractDisplay.getProperty(obj, "text");
        if (text == null && !(obj instanceof Color))
        {
            text = "" + obj;
        }
        if (text == null) return;
        if (text.length() > MAX_TEXT_LENGTH)
            text = text.substring(0, MAX_TEXT_LENGTH) + "...";
        paintCenteredText(g2, text, rect, 0.8, textColor);
    }