Home‎ > ‎Java‎ > ‎

Swing, Java2D, Threaded, MVC Exercise

Java  -  Portfolio  -  Resumes  -  C/C++  - Links  -  Photos  - Misc

Java 2D, Threaded, Swing, MVC Exercise
- Long-running random background graphics tests

This item was an exercise I did in Java/Swing so I could refresh my somewhat rusty Java skills. It has a stack (CardLayout) of three different random image/graphics generation programs, two of which are designed to consume a lot of CPU cycles. Below are example screenshots for one of the three algorithms (multi-gradient mode) that might be interesting from this Java/Swing exercise (the other two are boring).

The multi-gradient mode computes several random RadialGradienPaints and GradientPaints of random transparencies and then fills the client area with each of the paints, successively.

This example used an ExecutorService to invoke background tasks and also included a basic custom video frame sequence controller toolbar with programmatically-drawn icons, via Java 2D.  (The purpose of the slider was just to show that it is responsive to user input while the long-running computations are underway.  Otherwise, it does nothing.)

Below is a diagram describing the basic design and the variant of the Model View Controller pattern used:

Below is another example of multi-gradient mode (suitable for PowerPoint background with white text):

Copyright (c) Richard Creamer 2008 - All Rights Reserved