Search |
||
JavaFX Script Doodles, #2: a tabbed rectanglePosted by joshy on February 18, 2008 at 6:27 PM PST
Before I dive into my second doodle I'd like to mention the following Groodle. Allow me to explain. Andres Almiray saw my first JavaFX Doodle and decided to recreate it using the GraphicsBuilder syntax of Groovy; hence a Groodle! :) His first version is verbose, but later he updated it using the new alias syntax to be more compact. JavaFX is still a more concise syntax (IMHO), but Groovy is getting close and certainly has it's own strengths. I hope in the future Groovy will be another great way to build graphically rich apps on the Java platform. After all, why have one awesome way to build apps when you can have two! Be sure to watch Andres' excellent blog for updates. Now, on to the next doodle. A Tabbed Round RectangleThis is another sample for you to paste into NetBeans. It's a tabbed rectangle that looks like this:
Here's the basic code. I started by subclassing
So that's pretty straight forward. A clean definition with decent defaults. Good defaults are always important, since it lets developers get started right away. Now I could create this by drawing a rotated rectangle for the tab on top of a regular round rectangle, but that wouldn't be very dynamic. Really I want something that grows and shrinks properly. Then I can use it in cool transition effects, (more on that later). So instead of doing some funky shape unions I just made the shape out of curves and line segments. Note the
It's those bind statements above which contain the magic. Each part of the shape is defined in terms of the To use this new shape, just create an instance like this:
That will give you a decent looking shape but how about some animation? A nice transition would be handy. The code below does this by changing the
And here's what this would look like. Notice the
Enjoy. Any ideas for more doodles? »
Comments
Comments are listed in date ascending order (oldest first)
Submitted by aalmiray on Mon, 2008-02-18 23:00.
Thanks for the kind words Joshua, I'll be sure to let you know when Groodle #2 is ready =-)
Do you think you could put a webstart demo or a flash movie? I'll surely love to see your doodles in action.
Submitted by psychostud on Tue, 2008-02-19 05:28.
Can u please show how we can animate java fx components
Submitted by emcmanus on Wed, 2008-02-20 10:28.
This is another sample for you to paste into NetBeans.
It might be that I'm stupid, but I wasted a certain amount of time trying to get this sample to do something. It's not enough to paste it into NetBeans. You also have to click on the tiny preview icon above the editor window where you've pasted the code. The NetBeans experience leaves something to be desired here: the function of this icon isn't available on any menu (that I could find) and the familiar function Run, which is available through menus and a much bigger button, doesn't actually do anything useful.
Submitted by aalmiray on Tue, 2008-02-19 16:04.
Here is the link to Groodle #2 as promised: http://jroller.com/aalmiray/entry/gfx_doodle_2
Keep it up!
Submitted by magrawal on Sat, 2008-02-23 14:21.
I have been looking for a simple way to display RDBMS data in a desktop application. My observation is posted here.
Seems to be too much code and too many objects for a common task. Is it too much to wish for a swing jDBTable component that would work something like this (with all the nice BeansBindings happening in the background):
CachedResultSet rs = ResultSet.executeQuery();
jDBTable j = new jDBTable(rs); the ideal jDBTable would connect to the ResultSet while the frame is being rendered, so that it would be possible for users to select columns to display in a dialog. The JSF people have already accomplished most of this for the web. |
||
|