SoFunction
Updated on 2025-03-02

SWT (JFace) experience with dynamic gradient effect


package swt_jface.demo10;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
public class Animations {

    Display display = new Display();
    Shell shell = new Shell(display);
    public Animations() {

        (new FillLayout());
        ImageLoader imageLoader = new ImageLoader();
        final ImageData[] imageDatas = ("C:/icons/");
        final Image image = new Image(display, imageDatas[0].width, imageDatas[0].height);
        final Canvas canvas = new Canvas(shell, );
        (new PaintListener() {
            public void paintControl(PaintEvent e) {
                (image, 0, 0);
            }
        });
        final GC gc = new GC(image);
        final Thread thread = new Thread() {
            int frameIndex = 0;
            public void run() {
                while (!isInterrupted()) {
                    frameIndex %= ;
                    final ImageData frameData = imageDatas[frameIndex];
                    (new Runnable() {
                        public void run() {
                            Image frame =
                                new Image(display, frameData);
                            (frame, , );
                            ();
                            ();
                        }
                    });
                    try {
                        (imageDatas[frameIndex].delayTime * 10);
                    } catch (InterruptedException e) {
                        return;
                    }
                    frameIndex += 1;
                }
            }
        };

        (new ShellAdapter() {
            public void shellClosed(ShellEvent e) {
                ();
            }
        });
        (400, 200);
        ();

        ();
        while (!()) {
            if (!()) {
                ();
            }
        }
        ();
    }
    public static void main(String[] args) {
        new Animations();
    }
}