Thursday Apr 03, 2008
Monday Mar 03, 2008
Friday Feb 29, 2008
[Read More]
Wednesday Feb 27, 2008
It's been said that once a visitor goes to India he or she can hardly wait to get out, but that once out, can hardly wait to get back. In just such a return to India (he was there last year), Sun Executive Vice President for Software Rich Green gave the opening keynote at Sun Tech Days in Hyderabad. Of note is the fact that Green also made a return to Sun after a foray into the startup world. I don't know why Green left Sun, but I do know why he came back. I learned it in his interesting and expansive talk. The reason touches on the dramatic changes at Sun over the last year or two.
[Read More]Thursday Jan 10, 2008
If you've ever worked with threads in Swing, or even the SwingWorker class, you probably know that it can be a bit of a challenge. Fortunately, JSR 296 will allow you to create tasks that can be started and monitored with the use of a TaskMonitor. In addition, there is a TaskService class that can help you organize each of your tasks and fire them off.
The Swing Application Framework also supports various lifecycle methods that you get when extending specific framework classes, such as initialize(), startup(), ready(), and shutdown(). Just extend the appropriate class, override these methods, and you won't have to worry about trapping any obscure events and reacting to them again.
I was also very impressed by the resource injection. Basically, this means that you can do something like:
Resource file:
btnShowTime.text = Show current time! btnShowTime.icon = refresh.pngJava class:
btnShowTime = new JButton();
btnShowTime.setName("btnShowTime");
And at this point, the resources are injected into the btnShowTime class automatically. In addition, you can even do something like this:
Resource File:
MyPanel.greetingMsg = Hello, %s, a string was injected!Java class:
@Resource String greetingMsg; ResourceMap resource = ctxt.getResourceMap(MyPanel.class); resource.injectFields(this); String personalMsg = String.format(greetingMsg, txtName.getText()); JOptionPane.showMessageDialog(this, personalMsg);There is also a new API out there for beans binding. If you've never heard of beans binding before, the idea is that two properties in two different beans need to remain synchronized. This is actually part of JSR 295. In short, this means you can do something like this:
Property property1 = ELProperty.create(“${faceStyle}”);
Property property2 = BeanProperty.create(“value”);
Binding binding = Bindings.createAutoBinding(
UpdateStrategy.READ_WRITE,
object1, property1, // source
object2, property2); // target
binding.bind();
This will create a binding between the two objects such that if a value on either side changes, the other value will instantaneously be changed as well. It's simple, elegant, and it works! Kudos to Shannon Hickey and Scott Violet for a great addition to the Java APIs.
This blog copyright 2008 by dananourie