BackGroundGraphicpublic class BackGroundGraphic extends Object implements Graphic
Fields Summary |
---|
protected org.eclipse.swt.widgets.Canvas | drawCanvas | protected org.eclipse.swt.graphics.Image | bufferBackground | protected org.eclipse.swt.graphics.Color | lightGrey | protected org.eclipse.swt.graphics.Color | lightGrey2 | protected org.eclipse.swt.graphics.Color | colorWhite | protected org.gudy.azureus2.core3.util.AEMonitor | this_mon |
Constructors Summary |
---|
public BackGroundGraphic()
|
Methods Summary |
---|
public void | dispose()
if(bufferBackground != null && ! bufferBackground.isDisposed())
bufferBackground.dispose();
| protected void | drawBackGround(boolean sizeChanged)
if(drawCanvas == null || drawCanvas.isDisposed())
return;
if(sizeChanged || bufferBackground == null) {
Rectangle bounds = drawCanvas.getClientArea();
if(bounds.height < 30 || bounds.width < 100)
return;
if(bufferBackground != null && ! bufferBackground.isDisposed())
bufferBackground.dispose();
if(bounds.width > 2000 || bounds.height > 2000) return;
bufferBackground = new Image(drawCanvas.getDisplay(),bounds);
Color colors[] = new Color[4];
colors[0] = colorWhite;
colors[1] = lightGrey;
colors[2] = lightGrey2;
colors[3] = lightGrey;
GC gcBuffer = new GC(bufferBackground);
for(int i = 0 ; i < bounds.height - 2 ; i++) {
gcBuffer.setForeground(colors[i%4]);
gcBuffer.drawLine(1,i+1,bounds.width-1,i+1);
}
gcBuffer.setForeground(Colors.black);
gcBuffer.drawLine(bounds.width-70,0,bounds.width-70,bounds.height-1);
gcBuffer.drawRectangle(0,0,bounds.width-1,bounds.height-1);
gcBuffer.dispose();
}
| public void | initialize(org.eclipse.swt.widgets.Canvas canvas)
this.drawCanvas = canvas;
lightGrey = ColorCache.getColor(canvas.getDisplay(), 250, 250, 250);
lightGrey2 = ColorCache.getColor(canvas.getDisplay(), 233, 233, 233);
colorWhite = ColorCache.getColor(canvas.getDisplay(), 255, 255, 255);
| public void | refresh()
| public void | setColors(org.eclipse.swt.graphics.Color color1, org.eclipse.swt.graphics.Color color2, org.eclipse.swt.graphics.Color color3)
colorWhite = color1;
lightGrey = color2;
lightGrey2 = color3;
drawCanvas.redraw();
|
|