table renderer with icon like ms excel

hi,

again a question about renderers and so on.

i'm looking for a way to display some data in a table, according to some rules there should be an image displayed . One solution should be to use colorrenderers to correspond to a certain state of the data, but i don't want it to become a colorbook...

i already used a Jlabel, but the problem here is that the text hangs to the image..

i've triead a jpanel with a seperate jlabels for the text and icon, but the resizing is a problem.

So my question does anybody know how to do this, or knows about such an component. What i really want to achieve is to have the same in ms excel when you add a remark to cell, there becomes a red sign visible in the right upper corner.

Thx

found a first solution here, it is going to it; now the next thing should be to display a tooltip when over the red corner

http://forum.java.sun.com/thread.jspa?forumID=57&threadID=5117630

Message was edited by:

soulgod

[1017 byte] By [soulgoda] at [2007-11-26 17:37:15]
# 1

SOLUTION :

set in your renderer the border of the component you return to the following

class ATSBorder extends LineBorder {

public ATSBorder() {

super(Color.RED);

}

public void paintBorder(Component c, Graphics g, int x, int y,

int width, int height) {

g.setColor(lineColor);

int[] xPoints = new int[]{width - 7, width,width};

int[] yPoints = new int[]{0,0,7 };

int nPoints =3;

g.fillPolygon(xPoints, yPoints, nPoints);

}

}

soulgoda at 2007-7-9 0:05:23 > top of Java-index,Desktop,Core GUI APIs...