The problems that are related to the application context might be invisible from the outside of the Swing core libraries, but it has been a big deal for the Swing toolkit developers. Every time when you create a mutable static field in a Swing class you potentially introduce a security whole. It is quite surprising that an ordinary pattern of the Java language becomes a problem. To understand...
on Feb 9, 2012
Swing makes it very easy to control and modify simple components like JLabel or JButton. It gets trickier when you customize a compound component like JTree or JTable. Unlike a simple component, JTable consists of multiple subcomponents like table header, renderer and editor, so actually JTable is not a single component but a container with several descendants.
Imagine that you want to customize...
on Sep 7, 2011
In the list of the things that needs improving in Swing, the implementation of listeners takes the first place. The problem is the fact that the order in which listeners are notified is not specified and it is not even guaranteed that your listeners will be notified after the Swing system listeners. Actually all listeners can be mixed together with any possible combination and it leads to two...
on Jun 15, 2011
Generics doesn't work well with arrays. Everybody knows that you can't create a generified array,
but not many people really know what it was done this way.
A nice article from Brian Goetz helped me to understand the problem
when I studied the new features of JDK 5.
The arrays in java are covariant when generics are not. The following code clearly shows it:
String stringArray = new String[1...
on May 5, 2011
Checked exceptions are painful. I could write a long article about it,
but there are more than enough good blogs describing this problem. My favorite article is written by Rod Waldhoff.
From my point of view the existence of the InvocationTargetException clearly shows the problem.
Imagine you call a method which throws an exception, you properly catches it
and then you decide to rewrite the...
on Mar 21, 2011
We have all read the "Effective Java" book and know that we should prefer interfaces over abstract classes.
This is a known and respected pattern which should be used wherever possible.
However the years in the JDK team tauhgt me not to blindly trust
to good practices from the world of application programming.
A distinctive feature of the JDK is backward compatibility.
on Mar 11, 2011
I truly love the Swing GUI toolkit, I enjoy its flexibility, opennes and great abilities.
I know that some people say that Swing is too difficult to learn,
and I partly accept it because it took me several years working in the Swing team
to get the whole picture of the AWT, Java 2D and the Swing itself.
The Swing history counts more then 10 years and it is definitely not about end.
on Mar 9, 2011
Hello Swing community
While the SAF project is on hold, the Swing team welcomes the active development of the alternative implementations of the Swing framework. I found a few promising projects and put the links to them at the SAF project main page:
Better Swing Application Framework
and don't forget about the mature Netbeans Platform
I am happy to promote those projects. If...
on Nov 16, 2009
Java desktop team is working hard to move JDK7 forward.
I am happy to announce that Nimbus Look and Feel has been forward ported to JDK 7.Among all other changes, the latest build #b57
contains the fix for 6591875: Nimbus Swing Look and Feel.
It is a real pleasure to see the Nimbus LaF under "javax.swing.plaf" package! Check it out with the recent JDK 7 binaries.
JXLayer will also be there...
on May 4, 2009
As I promised in the previous entry, the work on the Swing Application Framework has been restarted. We already fixed a bunch of bugs, including #95, #69, #82 and we are not going to stop.
During our internal meetings we decided that we should be more in contact with developers who have experience in creating real applications on Swing. Only if you got trough all the obstacles you can give a...
on Mar 26, 2009
I know this is not good to disappear for a long time from blogging and SAF mail aliases, I am sorry about that. This happened because Swing team had some urgent temporary tasks to work on. The good news is that most of the tasks are completed and Swing team has returned to its primary goal - Swing library.
I should say that this time I have really come back to SAF and this project is currently...
on Mar 2, 2009
As you probably know, a few weeks ago I became the new specification lead for the Swing Application Framework project (JSR-296). This project has been fairly silent for the last little while, so it is high time to continue with working on this framework and complete it timely.
The main goal of this project is quite ambitious: create a Swing framework which allows to quickly create a simple...
on Aug 6, 2008
One of the biggest advantage of JXLayer 3.0 over the previous version is the ability to catch input events of its subcomponents. I started to think about this feature when I was asked if it was possible to implement the auto-scrolling feature with jxlayer. With JXLayer 2.0 you can easily paint a scrolling indicator on top of the wrapped component, but how to catch a mouse press event to activate...
on Jul 27, 2008
The JXLayer's functionality consists of two parts: painting issues and input event processing.
In this entry I'll describe painting in details, the second part will come shortly.
With the JXLayer you can easily customize the visual appearance of your component and the most trivial example is painting on top of a component. However you should know some details to implement it...
on Jul 17, 2008
LockableUI is definitely one of the most challenging feature in the JXLayer library. I have already written about why it was difficult and suggested several solutions and discuss the potential problems.
So it was a long way to make it right and now I am satisfied with the result.
In this entry I compiled all up-to-date information about this feature, so forget about the blocking glassPanes,...
on Jul 13, 2008
The mouse auto-scrolling is very popular these days for modern applications. I usually use this feature in the Firefox browser - you click the mouse wheel somewhere on the page and can immediately start scrolling.
A few months ago Kirill wrote an great review of the "auto-scrolling feature" implementation in Swing. I'd like to add one more item to the list.
Suppose you create a JTable, wrap it...
on Jun 24, 2008
It is my pleasure to announce a major update of JXLayer component.
The new version is hosted on its own java.net project jxlayer.dev.java.net, where I will also provide links to all my blogs about this component.
So, why I encourage everybody to try out the new JXLayer?
Actually to answer this question I am going to write several more blogs, here is a short answer:
more consistent and efficient...
on Jun 5, 2008
When I worked on the lightweight disabling of compound Swing components for my JXLayer project, I tried different approaches to workaround the problems with the custom painting of double-buffered components.
The last try was using the JComponent.print() method instead of JComponent.paint(), which effectively disables the double-buffering for the whole hierarchy of components. While it seems to...
on Apr 13, 2008
JDK 6 introduced plenty of cool desktop features, like famous gray-rect fix or advanced drag and drop support,
all of them made java much closer to the desktop application market and I am very exited about them.
There have been many blogs how useful new features are,
and I don't want to repeat them. Among all successful and well-designed features there is one which actually has not been completed...
on Feb 14, 2008
Few weeks ago I submitted a session for the next JavaOne and it reminded me the previous session which we presented with Kirill
Before J1, he published a nice teaser with links to blogs about his famous ghost effects and transition layout, so it's hight time for me drop a few lines about implementing a spotLight effect. You can test the whole application on the main page of the Rainbow project,...
on Nov 29, 2007