|
|
||
Kirill Grouchnikov's BlogJune 2006 ArchivesTetris Easter egg for Swing applicationsPosted by kirillcool on June 30, 2006 at 10:51 AM | Permalink | Comments (2)The Matrix rain project that was refactored to the laf-widget layer was not the first one. Even before that i took my first (ever) game written in Java and ported it to a (kind of) Easter egg for Swing apps. The project itself is called trellis and contains a collection Tetris-like games with pluggable shapes and rules. Currently, there are three different kinds of games and four different kinds of shapes. My personal would be the tetris on hexagonal grid, but it takes quite some time to get used to. As with the previous entry, here is the WebStart link. You'll have to either save it to your machine or run javaws http://weblogs.java.net/blog/kirillcool/archive/trellis/trellis.jnlp from the command prompt. When you hit Ctrl+Alt+T, you will see the following (quite ugly, since this was written back in 2001) selector screen:
Choose the game kind and the tile kind and click "Start the game". Based on your choice, you will have one of the 12 available games, such as the regular lines with square tiles:
A more exotic tetris on hexagonal grid:
Or even the esoteric piles with Mitsubishi grid:
The controls are:
Matrix screensaver for Swing apps - WebStartPosted by kirillcool on June 28, 2006 at 12:03 PM | Permalink | Comments (11)So, a number of people have asked for a WebStart version for the Matrix screensaver, so here goes: Wait for the application to load, hit Ctrl+Alt+M and enjoy the animation. Mouse click stops the screensaver and returns the control to the frame.
Matrix screensaver for Swing appsPosted by kirillcool on June 22, 2006 at 09:05 AM | Permalink | Comments (5)The last thing i did before moving to the States was taking one of my old apps (written for Java 1.1, so the entire imaging stack was written from the ground up, including the alpha channel blending, antialiased line drawing, index color models and such) and turning it into a Swing screensaver. The project page is right here, and once you run your application under laf-widget compliant look and feel, simply place matrix-rain.jar in the classpath and press Ctrl+Alt+M in your frame. Here are a few screenshots of the screensaver in progress:
If you decide to use the screensaver in your app, you may need to specify the heap size to be 256 or 378 megs, since some of the stuff is precomputed for smoother animation framerate. Last thing - this was written back in 2000-2003, so don't view the code as the correct way to use Java2D (since it doesn't use any). Liven up your app with fractal flamesPosted by kirillcool on June 21, 2006 at 04:20 PM | Permalink | Comments (1)The latest addition to one of the Substance plugins (watermark pack) provides a playground to experiment with fractal-based artwork. Much like the noise-based watermarks, you can play with the API to create your own (and sometimes stunningly beautiful) watermarks. The code is loosely based on the ideas from the flam3 site (see this PDF for some math). Feel free to explore some of the code right here. Here are some examples of the fractal flame watermarks along with the source code (the parameters are highly random chosen to create some interesting images. The first parameter is the degree of symmetry). The first image is that of kaleidoscope and is obtained by the following code (note the degree of symmetry is 4):
public class Kaleidoscope extends IteratedFunctionSystem {
public Kaleidoscope() {
super(4, new Functions.SphericalFunction(0.365654, 0.18286, 0.23786324,
0.234234, -0.4123234, 0.312123),
new Functions.ExFunction(0.234234, 0.987234, 0.23786324,
0.5345456, -0.98456465, 0.312123),
new Functions.SphericalFunction(0.88745, -0.8934734, -0.546312,
0.7896, -0.445899, 0.132468));
}
}
The second one is vortex and is obtained by the following code (no symmetry added):
public class Vortex extends IteratedFunctionSystem {
public Vortex() {
super(1, new Functions.HorseShoeFunction(-0.654897, 0.16886, -0.32645,
0.0598, 0.952376, -0.231534),
new Functions.HorseShoeFunction(0.31378, 0.451321, -0.234235,
-0.321534, -0.12436, -0.761234));
}
}
The third one is singularity and is obtained by the following code (degree of symmetry 2):
package org.jvnet.substance.watermarkpack.flamefractal;
public class Singularity extends IteratedFunctionSystem {
public Singularity() {
super(2, new Functions.SphericalFunction(0.365654, 0.987234, 0.23786324,
0.234234, -0.4123234, 0.312123),
new Functions.SphericalFunction(0.67656, 0.8934734, -0.546312,
-0.7896, -0.65487, 0.132468));
}
}
The last one is scriptures (my favourite - just trace all the repetitive nested marks) and is obtained by the following code (no symmetry added):
public class Scriptures extends IteratedFunctionSystem {
public Scriptures() {
super(1, new Functions.HorseShoeFunction(-0.654897, 0.16886, -0.32645,
0.0598, 0.452376, -0.231534),
new Functions.HorseShoeFunction(0.31378, 0.451321, -0.234235,
-0.321534, -0.12436, -0.761234));
}
}
Spicing up your JTabbedPane - part VPosted by kirillcool on June 20, 2006 at 01:36 PM | Permalink | Comments (12)This is the fifth part of the series that describes the additional capabilities that you can get on your tabbed panes.
First, you're welcome to read this blog entry that introduces the notion of widget into the world of look-and-feels. While Substance LAF is currently the only LAF supporting the "feel" widgets, the approach has been successfuly tested on six other third-party LAFs (Squareness, Pagosoft, Looks, Liquid, Infonode and Napkin. While the previous four parts described Substance-specific features, the introduction of laf-widget now allows additional third-party LAFs to provide tab overview dialog and tab hover preview. The new addition to laf-widget layer provides the functionality of Ctrl Tab Firefox plugin. Once you install that plugin, pressing Ctrl+Tab opens three windows, one in the middle that shows a large thumbnail of a tab (starts from the current tab), and two side windows displaying small thumbnails of previous and next tabs. Each press on Tab key (while Ctrl is pressed) moves the thumbnails forward (cycling). Once Ctrl is released, the currently shown tab (in the middle thumbnail window) is selected. For those of you who don't know, Swing already provides keyboard accelerators for switching the tabs. These are Ctrl+Page Up for moving forward and Ctrl+Page Down for moving backward. Two major disadvantages are:
| ||
|
|