 |
Painter Trailer
Posted by joshy on August 24, 2006 at 08:49 PM | Comments (11)
Coming soon! Hard hitting, action packed, and full of effects you probably never asked for.
It's Painters Extreme!
Okay, so maybe making a Painter trailer isn't such a good idea. Why do they call them "trailers" anyway, if they come before the movie?
Painters are a new technology for skinning your Swing GUI and it's going to let you do lots of cool things. Soon we'll be showing the new Painter APIs from SwingLabs, complete with tools, examples, and many opportunities to sit in code review meetings!
Until then I want to give you a sneak peak of what we've been up to. Hint: everything below was made without any code. Enjoy!





Bookmark blog post: del.icio.us Digg DZone Furl Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment
-
Hello Josh!
Painters are cool, and is most welcome addition to Swing. I think many don't know how usable they actually are. If you write APIs (like I do) you constantly find yourself wanting to decorate stuff without the option to subclass and you can't change the component in any way.
I have one requirement on the implementation that I would like to make you aware of. This scenario:
I want to decorate a JComponent but I don't know anything about it and I must not, in any way, change anything in it that makes someone else's code break. Visual artifacts is fine as long as the code runs. This means that I must be able to install a Painter on the component that as long as the other guys coding to the component follows the rules they won't get an exception or have their painter(s) removed.
This means that I need to be able to add my painter logically beside the painters already installed on the component. It also means:
That I can't for instance wrap the existing painter with a CompoundPainter to add my painter. That would change the Painter's class type and the adder of the other painter probably expect a certain painter class type and we have a CCE on our hands.
I obviously can't subclass the component to implement some custom painter handling. Dynamic runtime sub classing isn't here yet.
There must be a way to layer the painters with quite some granularity, there can't be just say five levels or so, it must be a rather high number with documented best practice in which layer on should put stuff. If two select the same layer the order might be undefined, that's fine.
It would be extremely useful if the painter (or a certain sublcass of Painter) could intercept events. That would give the painter adder the option to snatch events (say mouse presses) before it reaches the component. In the painter implementation we have for MiG Calendar we do this and a lot of features couldn't have been made without it since you can't (currently) add listeners in any particular order (something that would also be a well deserved addition to Swing).
Just some food for thought.
Cheers,
Mikael Grev
Posted by: mgrev on August 24, 2006 at 11:46 PM
-
Looks nice indeed.. will it be in JDK6 or a seperate lib? any documentation?
Posted by: ahmetaa on August 25, 2006 at 06:38 AM
-
I want Painters....
leouser
Posted by: leouser on August 25, 2006 at 07:05 AM
-
Looks nice. But now you've got me hooked and I can't wait; I'll have to look at the painter_work.
--Bill
Posted by: wsnyder6 on August 25, 2006 at 07:14 AM
-
They're called trailers because they used to come at the end of the film (they trailed it). They moved to the front after the credits started including everyone, their brothers, sisters, aunts, 3rd grade teachers, and someone who looked cross-eyed at them once. The film people noticed that the public wasn't staying through all of that to see what was coming so to get you to watch the commercial err..."trailier", they were moved. Advertising will always take precedence.
Posted by: jkeesey on August 25, 2006 at 08:54 AM
-
jkeesey - do you have any evidence for that? What about 'trail blazers' as the origin of the word? I have no evidence either and I can't afford a copy of the OED.
Posted by: c_armstrong on August 26, 2006 at 03:37 AM
-
c_armstrong: well wikipedia agrees as well as a couple other online etymologies. But I don't know what you'd consider definitive.
Posted by: jayds on August 29, 2006 at 06:15 AM
-
Mikael -- see javadoc and source for JLayeredPane. It provides an integer's worth of layers, painting w/o knowledge of what you're painting over (or under), and automatically handles events (without any extra effort).
For an example of several effects using JLayeredPane, see http://rabbit-hole.blogspot.com/2006/04/decoratingoverpainting-swing.html and http://rabbit-hole.blogspot.com/2006/06/decorator-update.html.
Posted by: twalljava on August 29, 2006 at 12:34 PM
-
twalljava -- Yes, the layering of the painters should be as flexible as the layering in JLayeredPane. However, JLayeredPane and painters are not the same thing. They don't solve the same problem.
Posted by: mgrev on August 31, 2006 at 10:49 AM
-
When are we going to see Painter in Action ?
Days ? Months ?
Till then can we have more "Trailers" pls.
Posted by: kishoresjava on September 04, 2006 at 12:47 AM
-
They will be more soon. Sorry about that. Two things have conspired to keep me from writing. First were some last minute changes to an update release of Java. The other is that my wrists have been acting up again. Fear not, however, I have found a very good doctor and should be up and typing again soon.
This week I am visiting two LA Java Users Groups and speaking with some customers before heading back north. I promise more Painter stuff next week.
Posted by: joshy on September 04, 2006 at 04:52 PM
|