Chaos Game Applet

Sunday, April 22nd, 2007 01:52 pm
flwyd: (java logo)
[personal profile] flwyd
[Chaos Game] I spent most of yesterday and the first part of today writing a Java applet implementation of the Chaos Game. I find that the color schemes help significantly to understand why configurations lead to the patterns they do. The original description (which explains verbally better than I have) just featured monochrome images.

While I write Java code every day at work, most of it is data-focused. Data-focused GUIs (put this field over here, put these buttons in this panel over here) are important and often tricky to get right, but it's been years since I did anything with public void paint(Graphics g). Playing with code which requires no database, no metadata configuration, and no client-server communication was also refreshing.

You'll need at least Java 1.4 to view the applet. I compiled from Eclipse running under Java 1.5 and while I don't think I used any new API methods I didn't have a 1.4 JVM convenient for testing. Let me know if you can't get it to work.

Date: 2007-04-22 08:19 pm (UTC)
From: [identity profile] dr-tectonic.livejournal.com
That's pretty awesome! The coloring is, indeed, very informative.

The Color Scheme combo box only displays one entry for me. (WinXP/Firefox/Java 1.4.2_03-b02) Otherwise, looks great.

Do you know about http://processing.org ?

Date: 2007-04-22 08:37 pm (UTC)
From: [identity profile] flwyd.livejournal.com
Shoot. The combo box (a lightweight component) is probably getting obscured by the Canvas (a heavyweight component). This is what I get for testing on OS X where everything is a native component. I'll test with Linux and see if I can come up with an all-lightweight solution. You should be able to change selection with the up and down arrow keys, though.

Date: 2007-04-25 05:40 am (UTC)
From: [identity profile] flwyd.livejournal.com
Bug fixed. Turns out there's no JCanvas because subclassing JComponent accomplishes the same goal.

Heheh.

Date: 2007-04-23 12:41 am (UTC)
From: [identity profile] mackys.livejournal.com
4 sides, 0.55 distance looks like the Sun logo.

Cool little applet. I need to make a tetris applet for my own amusement.
May 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 2025

Most Popular Tags

Expand Cut Tags

No cut tags
Page generated Monday, June 9th, 2025 04:24 am
Powered by Dreamwidth Studios