super(parent, checkStyle(style)); addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e){
/** * Stop the animation if it is not already stopped and * reset the presentation to a blank appearance. * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public synchronized void clear(){ checkWidget(); if (active) stop(); showStripes = false; redraw(); } @Override
@Override public void paintControl(PaintEvent e) { paint(e); } });
void paint(PaintEvent event) { GC gc = event.gc; Display disp= getDisplay(); Rectangle rect= getClientArea(); gc.fillRectangle(rect); if (showBorder) { drawBevelRect(gc, rect.x, rect.y, rect.width-1, rect.height-1, disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); } paintStripes(gc); } void paintStripes(GC gc) {
Rectangle rect= getClientArea(); Color color = getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION); gc.setBackground(color); gc.fillRectangle(rect); gc.setForeground(this.getBackground()); int step = 12; int foregroundValue = value == 0 ? step - 2 : value - 2;
/** * Start the animation. * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public synchronized void start() { checkWidget(); if (active) return; active = true; showStripes = true; final Display display = getDisplay(); final Runnable [] timer = new Runnable [1]; timer [0] = new Runnable () { @Override public void run () { if (!active) return; GC gc = new GC(AnimatedProgress.this); paintStripes(gc); gc.dispose(); display.timerExec (SLEEP, timer [0]); } }; display.timerExec (SLEEP, timer [0]); } /**
@Override public Point computeSize(int wHint, int hHint, boolean changed) { checkWidget(); Point size = null; if (orientation == SWT.HORIZONTAL) { size = new Point(DEFAULT_WIDTH, DEFAULT_HEIGHT); } else { size = new Point(DEFAULT_HEIGHT, DEFAULT_WIDTH); } if (wHint != SWT.DEFAULT) size.x = wHint; if (hHint != SWT.DEFAULT) size.y = hHint; return size; } private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topleft, Color bottomright) {
void paint(PaintEvent event) { GC gc = event.gc; Display disp= getDisplay(); Rectangle rect= getClientArea(); gc.fillRectangle(rect); if (showBorder) { drawBevelRect(gc, rect.x, rect.y, rect.width-1, rect.height-1, disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); } paintStripes(gc); } void paintStripes(GC gc) {
Rectangle rect= getClientArea(); Color color = getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION); gc.setBackground(color); gc.fillRectangle(rect); gc.setForeground(this.getBackground()); int step = 12; int foregroundValue = value == 0 ? step - 2 : value - 2;
/** * Start the animation. * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public synchronized void start() { checkWidget(); if (active) return; active = true; showStripes = true; final Display display = getDisplay(); final Runnable [] timer = new Runnable [1]; timer [0] = new Runnable () { public void run () { if (!active) return; GC gc = new GC(AnimatedProgress.this); paintStripes(gc); gc.dispose(); display.timerExec (SLEEP, timer [0]); } }; display.timerExec (SLEEP, timer [0]); } /**
@Override public Point computeSize(int wHint, int hHint, boolean changed) { checkWidget(); Point size = null; if (orientation == SWT.HORIZONTAL) { size = new Point(DEFAULT_WIDTH, DEFAULT_HEIGHT); } else { size = new Point(DEFAULT_HEIGHT, DEFAULT_WIDTH); } if (wHint != SWT.DEFAULT) size.x = wHint; if (hHint != SWT.DEFAULT) size.y = hHint; return size; } private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topleft, Color bottomright) {
void paint(PaintEvent event) { GC gc = event.gc; Display disp= getDisplay(); Rectangle rect= getClientArea(); gc.fillRectangle(rect); if (showBorder) { drawBevelRect(gc, rect.x, rect.y, rect.width-1, rect.height-1, disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); } paintStripes(gc); } void paintStripes(GC gc) {
super(parent, checkStyle(style)); addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e){
/** * Stop the animation if it is not already stopped and * reset the presentation to a blank appearance. * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public synchronized void clear(){ checkWidget(); if (active) stop(); showStripes = false; redraw(); } @Override
Rectangle rect= getClientArea(); Color color = getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION); gc.setBackground(color); gc.fillRectangle(rect); gc.setForeground(this.getBackground()); int step = 12; int foregroundValue = value == 0 ? step - 2 : value - 2;
/** * Start the animation. * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public synchronized void start() { checkWidget(); if (active) return; active = true; showStripes = true; final Display display = getDisplay(); final Runnable [] timer = new Runnable [1]; timer [0] = new Runnable () { @Override public void run () { if (!active) return; GC gc = new GC(AnimatedProgress.this); paintStripes(gc); gc.dispose(); display.timerExec (SLEEP, timer [0]); } }; display.timerExec (SLEEP, timer [0]); } /**
@Override public Point computeSize(int wHint, int hHint, boolean changed) { checkWidget(); Point size = null; if (orientation == SWT.HORIZONTAL) { size = new Point(DEFAULT_WIDTH, DEFAULT_HEIGHT); } else { size = new Point(DEFAULT_HEIGHT, DEFAULT_WIDTH); } if (wHint != SWT.DEFAULT) size.x = wHint; if (hHint != SWT.DEFAULT) size.y = hHint; return size; } private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topleft, Color bottomright) {
@Override public void paintControl(PaintEvent e) { paint(e); } });
void paint(PaintEvent event) { GC gc = event.gc; Display disp= getDisplay(); Rectangle rect= getClientArea(); gc.fillRectangle(rect); if (showBorder) { drawBevelRect(gc, rect.x, rect.y, rect.width-1, rect.height-1, disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); } paintStripes(gc); } void paintStripes(GC gc) {
super(parent, checkStyle(style)); addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { redraw(); addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { paint(e); addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e){ stop();