package demo.node;
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.Label;
public class Node extends Label {
@Override
protected void paintFigure(Graphics graphics) {
graphics.translate(bounds.x, bounds.y);
graphics.setForegroundColor(ColorConstants.gray);
graphics.setAlpha(100);//这个设置透明度,0-255
graphics.fillGradient(0,0,bounds.width,bounds.height,true);
graphics.setAlpha(255);
if(getIcon()!=null)
graphics.drawImage(super.getIcon(), getIconLocation());
graphics.setForegroundColor(ColorConstants.black);
graphics.drawString(super.getText(),super.getTextLocation());
}
}
Node label1=new Node();