Programming Fundamentals with Processing

Kind of a big day here. I’ve decided to put online what I’ve written so far of my book on Processing. I’m pretty sure this will motivate me to do more work on it.

I’m about 80% done with the first half. I’m sort of thinking that once the first half is actually done, I might try a Kickstarter or GoFundMe.

Feel free to kick my butt about this.

Changing Processing’s Look and Feel

processing-lnf-metal

The Java Look and Feel that Processing uses by default on Linux can get a bit wonky. Depending on the GTK theme you are using, menubars can actually become unusable!

processing-menubar-adwaita-x-dark
Where’s the menu?

You can change the Look and Feel to something that works by editing the file:

/home/USERNAME/.processing/preferences.txt

Be sure that Processing is not running when you do this. To use the standard Swing Metal Look and Feel, change the lines that read:

editor.laf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
editor.laf.linux=com.sun.java.swing.plaf.gtk.GTKLookAndFeel

to:

editor.laf=javax.swing.plaf.metal.MetalLookAndFeel
editor.laf.linux=javax.swing.plaf.metal.MetalLookAndFeel
processing-menubar-lnf-metal
Metalized menubar

Metal may not be pretty, but it seems to be pretty robust!

Note that because Processing uses its own JRE, it will ignore LnF and other settings you may have configured for your default JRE.

Processing: Capture is a PImage

Ds8_roll

Something the documentation on Processing’s Capture class doesn’t mention is that Capture is derived from PImage. I went digging into the Capture source code to figure that out:

public class Capture extends PImage implements PConstants { ...

This means all the methods and fields available to PImage objects should also be available to Capture objects. This makes video processing a lot easier!