Skip to main content

Articles & Jars

About This Project

Legal


Below is a list of ... everything noteworthy in this project. Most of these entries refer to specific blog articles, but not all of them.

[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

This is a very short article with a little hands-on demo of how the different AlphaComposite types interact.

This doesn't necessarily teach anything or present new ideas; it's just a quick applet to consult if you need it.

[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

Take a JSlider. Add a AngleSliderUI. Voila! You have a GUI widget for angles.

Comes in Aqua and non-Aqua flavors.

Buttons: New UIs     (August 2009)
[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

Sure the buttons in Apple's Tech Note 2196 are great, but they're so... black-box-ish. And they're only available on Macs.

This article sets up a new framework for ButtonUIs, and provides around 10 UI's to choose from. (But you can make more if you want to...)

Colors: a Color Dialog     (April 2007)
[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

This is a Photoshop-style color choosing dialog.

You can pull some parts of it apart for customization, but out-of-the-box it offers a great interface if you're dealing with a power user.

Of course: all dialogs are at least slightly evil, and they should be used with care...

Colors: a ColorPalette     (January 2010)
[ Source   Binary   Both ]     [ Applet ]
Demo Graphic

This is an isolated GUI component from this article.

This app shows the progression of several different concepts for ColorPalettes. (Hopefully each one is an improvement over the previous?)

[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

This jar includes all my color-related GUI components: the ColorPicker, the ColorWell, and the ColorPalette.

I'm not going to argue that this will meet your needs and save the world; but it includes a lot of useful tools and it might help (save the world).

[ Source   Binary   Both ]     [ Article ]

As far as I can tell: there's not a good (efficient) way to crossfade two translucent images in Java2D.

(Crossfading opaque images? That's easy. But not translucent ones.)

This article focuses on discussion and not a downloadable end result.

[ Source   Binary   Both ]     [ Article ]

In lots of Apple's software there's a handy menu option called "Customize Toolbar" that lets users drag and drop components in a toolbar. It's functional and great eye candy.

This article presents a similar mechanism for Java. A single thumbnail doesn't do justice to this feature, but if you go to the article you'll see a screencast.

[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

This is a little toy I made a while ago that really adds a lot of pizazz to a JPanel.

You might argue it adds too much pizazz, and so it should be used sparingly. :) But on occasion it has definitely come in handy. The thumbnail doesn't do it justice, though...

[ Source   Binary   Both ]     [ Article ]

What can you do when your event dispatch thread is blocked?

For starters: this article mentions how to automatically detect this situation and get great console output to help pinpoint the problem. Also this delves into a very murky partial solution. (It has worked multiple times for me, but it uses unsafe deprecated black magic.)

Gradients: Using TexturePaint for Gradients     (November 2009)
[ Source   Binary   Both ]     [ Applet ]

This class uses a java.awt.TexturePaint to render a multiple-color linear gradient.

This was mostly an experiment I put together for this article. As of this writing I'd only recommend using this if you can't use the MultipleGradientPaint in Java 1.6 or its earlier incarnations in the batik project.

This is functional, though. And if you're stuck in an earlier Java version: it's a very small class to add if you need it.

[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

This is a concise GUI component to arrange the distribution of colors for complex gradients.

(By default it also leans heavily on some existing color GUI widgets I wrote, but you can replace those with your own components if you want to.)

Gradients: a Halftone Gradient     (November 2009)
[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

This is a handy little gradient that resembles halftone print.

I came across this idea by accident while working on the TransformedTexturePaint class.

Graphics2D: Improving Performance     (February 2009)
[ Source   Binary   Both ]     [ Article ]

It turns out some Graphics2D operations are painfully inefficient -- and we can easily intercept and divert those methods!

This is becoming less of a problem now that Quartz is being phased out, but even without Quartz we can still make some improvements...

[ Source   Binary   Both ]     [ Article ]

This has been a real life-saver when I'm trying to debug our graphics-rich desktop apps at work.

I prewire it so pressing F4 serializes the foremost window, and then whenever something isn't rendering right I can see where each graphic instruction is being called from.

[ Source   Binary   Both ]     [ Article ]
Demo Graphic

This is a refresher on how to get at NSImages on Mac 10.5.

Also: if you're like me you have no idea what images are out there to be accessed. :) This article also provides a table of the images we have at our disposal, as well as a few comments about some of them.

Images: BMPs and Thumbnails     (June 2010)
[ Source   Binary   Both ]     [ Article ]

This provides an efficient mechanism for creating BMP thumbnails, and a crude BMP decoder/encoder.

Images: Managed Images     (April 2007)
[ Source   Binary   Both ]     [ Article ]

There used to be a way to completely ruin your graphics performance.

This problem can still occur on Mac if you're use the Quartz rendering engine, but more and more that is being phased out so this is less of a problem than it used to be.

[ Source   Binary   Both ]     [ Article ]

This demonstrates a class that extracts thumbnail information out of a JPEG.

ImageIO can do this: but only if you already have JAI installed on your machine.

Images: Scaling Down     (June 2010)
[ Source   Binary   Both ]     [ Article ]
Demo Graphic

This improves the image quality and memory allocation when scaling large BufferedImages to thumbnails.

[ Source   Binary   Both ]     [ Article ]

Need to scale megapixel JPEGs on-the-fly without loading them entirely into memory? This might just do the trick.

[ Source   Binary   Both ]     [ Article ]

I never did trust MediaTracker. Why does it require a java.awt.Component to tell if an image is loaded?

Here I wrote my own class that converts abstract java.awt.Images into BufferedImages.

    [ Article ]

We needed to display modal dialogs in full-screen mode. On Mac this proved to be in impossible using normal JDialogs, so we had to come up with an alternative solution.

[ Source   Binary   Both ]     [ Article ]
Demo Graphic

I find the JOptionPane hard to work with sometimes. If you want a really polished dialog -- with a help button, the right spacing, the right controls to escape, etc. -- you might just want to make a new model.

Really: check out the javadocs for this one. There's a lot of research/explanation in there.

Jars: Building Concise Jars     (January 2009)
[ Source   Binary   Both ]

If I used an ant script or Eclipse's built-in jar-exporting widget: I'd need to specify up front the classes I want to put into a jar.

This class uses the javac command to figure that out for me.

[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

This article examines the notion of a well-designed inspector.

It uses this interface to layout the components, and it presents a few implementations of that interface (with varying degrees of success/hackery).

Math: Solving Equations with Gaussian Elimination     (December 2009)
[ Source   Binary   Both ]     [ Applet ]

I've used the Equations class for a long time now. (Especially in the TransformUtils class.)

But recently I needed something more. I ended up making this class to add a light GUI to interface with the Equations class.

This is a very minimal, no-frills app. But it can solve equations for you that might otherwise make your head hurt. :)

[ Source   Binary   Both ]     [ Article ]

The java.lang.Math class was designed with accuracy in mind.

But if you're dealing with graphics: you can probably fudge on some accuracy in exchange for speed. What methods can be improved?

[ Source   Binary   Both ]     [ Article   Applet ]

This triggers mouseClicked events even if the mouse moves a few pixels between click and release.

[ Source   Binary   Both ]     [ Article ]

This article presents a class that can write a .mov file as a series of images and PCM audio.

This movie uses a combination of JPG/PNG and WAV encoding, which is very poor compression. But this format is not subject to nasty patent/royalty issues.

[ Source   Binary   Both ]     [ Article ]

Can we improve on the java.awt.PixelGrabber?

If you're only working with a BufferedImage and not an abstract Image: you might be able to really improve performance with the ARGBPixelGrabber.

[ Source   Binary   Both ]     [ Article ]
Demo Graphic

This emulates two types of preferences on Mac: several rows of preferences (like the System Preferences) or one row of preferences (like Mail, Safari, etc.).

Print Dialogs: Laying Out Tiles     (November 2008)
[ Source   Binary   Both ]     [ Article ]
Demo Graphic

This introduces an object to lay out several graphic objects on a sheet of paper, and a dialog to preview and edit this layout.

(Oh: and it prints.)

Progress: a Spinny Widget     (May 2009)
[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

This introduces a new UI for JProgressBars. It comes in 2 flavors: Mac-like and generic.

They're vector-based, so while they're originally designed to be less than 20x20 pixels: they scale well if you need them to.

[ Source   Binary   Both ]     [ Article ]

This iterates over each frame an a QuickTime movie. Each frame is returned as a BufferedImage, and you can see how long each frame is supposed to be.

Note that this uses QuickTime for Java, which is now officially deprecated.

[ Source   Binary   Both ]     [ Article ]

This demonstrates how to interface with QuickTime for Java and grab pixel data from a QDGraphics and render that in a JComponent

QuickTime for Java is now deprecated, though, so I don't recommend starting any new projects with this information...

Runtime Properties: kind of important     (May 2008)

This lets your browse your UIManager's constants.

... and your SystemColors. And your System.getProperties().

[ Source   Binary   Both ]     [ Article ]

The Robot class can capture parts of your screen as an image, but it can be slow to process so many pixels. This article ties into the RepaintManager to only capture the areas of interest.

Also this jar can export this animation as a MOV file (using JPEG moving encoding). All 100% Java.

[ Source   Binary   Both ]     [ Article   Applet ]

This article explores a GUI that manipulates a shape with bezier shape segments.

[ Source   Binary   Both ]     [ Article ]

How do you get the bounds of a shape? A GeneralPath may return a much larger rectangle than necessary. An Area will be accurate, but they're always so slow to work with!

This article explains (and presents) code to calculate shape bounds yourself.

[ Source   Binary   Both ]     [ Article   Applet ]

What's the most common shape we need to clip to? A Rectangle.

But if we use Areas our performance will tank. This demonstrates a simple model that iterates over a path exactly once to get the clipped shape.

(This does not use Sutherland-Hodgman clipping algorithm or the Weiler-Atherton clipping algorithm.)

[ Source   Binary   Both ]     [ Article ]

This project branches off the Area class and optimizes parts of its performance. The underlying algorithms are not changed, but (in some cases) the performance is considerably improved.

[ Source   Binary   Both ]     [ Article ]

This breaks a path with cubic curves into several small quadratic curves.

You lose a little precision: but if (for whatever reason) you want quadratic curves: here you go!

[ Source   Binary   Both ]     [ Article   Applet ]

If the user drags the mouse over a JComponent, then you can collect a series of points. This project takes those points and replaces the line segments with attractive bezier curves.

Shapes: Measuring Length     (February 2009)
[ Source   Binary   Both ]     [ Article   Applet ]

An uninteresting but very useful class that deals with measuring shapes.

[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

This is a two-fold article:

  • This presents the ParametricPathIterator to convert parametric equations into java.awt.Shapes.
  • As a proof of concept: this presents the Spiral2D.

Shapes: an Introduction     (March 2010)
    [ Article ]

This covers some nitty gritty details about java.awt.Shapes that I refer to (or take for granted) in other shape-related articles.

There is nothing to download here. Just read the article if you're interested.

Slideshows: Transitions & SWFs     (November 2008)
[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

A fun set of transitions defined with a simple vector-graphics-ish architecture.

The demo includes a player and minimal Flash export.

Strokes: a Bristle Stroke     (May 2008)
[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

A stroke based on splattering lots of tiny shapes along a path.

Strokes: a Brush Stroke     (April 2007)
[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

A stroke based on rendering several smaller strokes in parallel along a path.

[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

A stroke that resembles a nib at a fixed angle.

Strokes: a Charcoal Stroke     (December 2008)
[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

A stroke with grooves in the edges that resembles charcoal on pavement.

This stroke is actually a filter than can modify any shape, but the only current suitable examples are BasicStrokes and CalligraphyStrokes.

Text: Effects and Block Shadows     (February 2011)
[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

Create some fun text effects using block shadows.

Text: Prompts and Search Fields     (December 2009)
[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

This article has 2 goals:

  • Display a gray prompt over a JTextField if it doesn't have the focus.
  • Implement a RoundTextFieldUI (with an optional magnifying glass).

Text: Searching JTextComponents     (December 2009)
[ Source   Binary   Both ]     [ Article   Applet ]
Demo Graphic

This discusses different GUIs for the user to search for a string in a JTextComponent.

This includes the common search dialog, the model Safari uses and the model Firefox uses.

Text: Swivel Animations     (Mar 2012)
[ Source   Binary   Both ]     [ Article   Applet ]

This animation idly skims over a series of text boxes by panning and zooming at interesting angles.

[ Source   Binary   Both ]     [ Article ]

This walks through how to find the preferred height of a block of text, and provides a GUI component to display text with a fixed width.

[ Source   Binary   Both ]     [ Article   Applet ]

This discusses/demos a class that combines these two elements.

Transitions: Apply Transitions to a JTabbedPane     (January 2009)
[ Source   Binary   Both ]     [ Applet ]

This applies some basic Transition2D's to a JTabbedPane when you change tabs.

Windows: Adding a Window Menu     (November 2008)
[ Source   Binary   Both ]     [ Article ]
Demo Graphic

This article discusses and emulates the "Window" menu found on Macs.

Windows: Dragging Made Easy     (April 2007)
[ Source   Binary   Both ]     [ Article ]

Sometimes you want to be able to click and drag a window, palette, dialog etc.

 
 
Close
loading
Please Confirm
Close