Monday, July 25, 2011

Looking back at Swing

I am currently using a Java third party library that uses Swing classes. I had to perform a simple task today, which included creating a Label with an Icon, using Swing's ImageIcon class. I looked into swing six years ago. Then, at the time I was the first Flex person in a Java developer’s team. The company I was working for was switching from Swing to Flex. It is interesting to look at Swing and learn how the concept of productivity in a GUI development environment has changed over such a short time period. For instance, this is how the Swing manual suggests that you create a label with an Icon:

ImageIcon icon = createImageIcon("images/middle.gif",
"a pretty but meaningless splat");
label1 = new JLabel("Image and Text", icon, JLabel.CENTER);
label3 = new JLabel(icon);

/** Returns an ImageIcon, or null if the path was invalid. */
protected ImageIcon createImageIcon(String path,
String description) { imgURL = getClass().getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL, description);
} else {
System.err.println("Couldn't find file: " + path);
return null;
Can you imagine? All this code is required for a simple Label with an Icon! Software
development has changed in the last few years. Platforms and languages are expected to be more efficient and require less code and time from the developer.


Oleg Rudenko said...

Glag to see such optimistic opinion.

If you would take a look on Delphi 1 released in 1997 or Delphi 3 from 1999 you probably will change your mind.

15 years ago it was a lot easier to create GUI in Delphi than now in Flex 4.

Lior Boord said...

Interesting, this is actually not the first time I hear this opinion regarding Delphi.