Posted by editor
on January 14, 2012 at 4:12 PM PST
We've just published Michael Bar-Sinai's new article "PanelMatic 101". The article introduces PanelMatic, an open source project that provides Swing developers with methods to easily construct common user interface panels. Michael introduces PanelMatic by expressing the problem it was developed to solve...
We've just published Michael Bar-Sinai's new article "PanelMatic 101" . The article introduces PanelMatic , an open source project that provides Swing developers with methods to easily construct common user interface panels. Michael introduces PanelMatic by expressing the problem it was developed to solve:
Every Swing developer knows this feeling: you've got the design of a UI panel. It's the 'right' design. It 'works'. It's what the user would expect. Hell, it's even what you would expect had you been the user. But it is going to be an awful lotta coding to lay it out in Swing - even before you take into consideration issue like panel re-sizing and localization.
Figure 1 in the article illustrates the process from handwritten design, through PanelMatic coding, to the final result:
Figure 1. Panel layout: Sketch, PanelMatic code, GUI panel
That's a pretty snazzy result for such a small amount of code. How is it possible?
Panels are built top-to-bottom (or, more precisely, on the page axis). There is an intuitive connection between the way the code looks and the way the created panel will look. Components can be added to the panel with a label and/or an icon (lines 3-7), or alone (line 9). By default components stretch to occupy all the space they get, but this can be changed using modifiers (lines 9, 10). L_END (stands for "line end") and GROW (stands for "grow") are statically imported constants, and are in fact full-blown object that implement the BehaviorModifier interface - so you can create your own modifiers if you need 'em. Client code can add headers (lines 2, 8) and flexible spaces (not shown). The default implementation uses a pluggable component factory to create all the extra components involved (e.g. JLabels), so you can customize them when the defaults won't do.
But there's more than just layout to PanelMatic. In "PanelMatic 101" , Michael covers customizers (for listening to all components on a panel), localizations, building panels using expressions, and advanced customizations. Read the article for the details, and visit the PanelMatic project site to get started with using PanelMatic.
Since my last blog post , several people have posted new java.net blogs :
Our current java.net poll asks How soon do you plan to start using the just-released NetBeans 7.1? . Voting will be open until Friday, January 20.
Here are the stories we've recently featured in our Java news section:
Our latest java.net
href="http://www.java.net/archive/spotlight">Spotlight is Roger Brinkley's Java Spotlight Episode 64: NetBeans 7.1 Release :
Interview with Geertjan Wielenga, Principal Product Manger in Oracle Developer Tools on NetBeans 7.1 release. Joining us this week on the Java All Star Developer Panel are Dalibor Topic, Java Free and Open Source Software Ambassador and Daniel deOliveira, Java Champion and DFJUG Leader...
Previously, we highlighted the new article by Adam Bien: Interfaces on Demand with CDI and EJB 3.1 :
Since Java Platform, Enterprise Edition 6 (Java EE 6), interfaces are no longer required by the container in order to realize common use cases. Transactions, security, custom aspects, concurrency, and monitoring are also available for plain classes without any interfaces. Java EE 6 made interfaces meaningful again...
Subscriptions and Archives: You can subscribe to this blog using the java.net Editor's Blog Feed . You can also subscribe to the Java Today RSS feed and the java.net blogs feed . You can find historical archives of what has appeared the front page of java.net in the java.net home page archive .
-- Kevin Farnham