Tooltip Transparency

Hi

I'm trying to create a tooltip with semi-transparent background, so far i've tried changing the paint method by extending the TooltipUI class, but so far I haven't had much luck, the background color fades, but it does not show the background, i've been using this to set transparency:

publicvoid paint(Graphics g, JComponent c){

Composite compo= AlphaComposite.getInstance(AlphaComposite.SRC_ATOP,

.7f);

Graphics2D g2 = (Graphics2D)g;

g2.setComposite(compo);

g2.setColor(new Color(255,0,0));

g2.fillRect(0,0,c.getWidth(),c.getHeight());

}

Like i said, the color fades, but it does not show anything that's behind, any help on this would be appreciated

[895 byte] By [Leandro.Fonsecaa] at [2007-10-3 5:13:51]
# 1
I would guess that somewhere in your code you would need to make the tooltip non-opaque.
camickra at 2007-7-14 23:20:19 > top of Java-index,Desktop,Core GUI APIs...
# 2
maybe calling super.paint(g, c); can help...
stevopsa at 2007-7-14 23:20:19 > top of Java-index,Desktop,Core GUI APIs...
# 3

return new JToolTip() {

public void addNotify() {

super.addNotify();

((JComponent)getParent()).setOpaque(false);

getParent().setBackground(null);

}

public void paint(Graphics g) {

Composite compo= AlphaComposite.getInstance(AlphaComposite.SRC_ATOP,

.7f);

Graphics2D g2 = (Graphics2D)g;

g2.setComposite(compo);

g2.setColor(new Color(255,0,0));

g2.fillRect(0,0,10,10);

}

};

DANGER

IanSchneidera at 2007-7-14 23:20:19 > top of Java-index,Desktop,Core GUI APIs...
# 4
thanks for the help
Leandro.Fonsecaa at 2007-7-14 23:20:19 > top of Java-index,Desktop,Core GUI APIs...