Pages

Friday, September 11, 2009

Using JTabbedPane on Swing Application Framework (JSR-296)

I was trying to figure out how to set the selected tab for a multi-tab JTabbedPane on my Swing Application Framework application. I thought that a quick Google search would have a simple answer. This was not the case. I found a post on a forum where a number of other people were wondering how to do it. So here is a summary of how I did it.

On the Frameview, I added a method as show below:

public void setSelectedTab (Integer tabIndex) {
tabPanel.setSelectedIndex(tabIndex);
}


The tabPanel in my case is the JTabbedPane instance.

In the SingleFrameApplication, I modified the startup() method to display the tab I want.

Note: You must set it after a call to show() the FrameView

@Override
protected void startup() {
FrameViewImpl frameView = new FrameViewImpl(this);
show(frameView);
//This must be done after the GUI is displayed
frameView.setSelectedTab(0);
}

Thursday, September 10, 2009

Beans Binding Part Deux

I have really enjoyed using the Beans Binding Framework (JSR-295) in the past. It was a really good start to making Swing a more usable platform doing client development. The project and JSR have been left abandoned by Sun. In large measure this was the result of development work done by Sun on JavaFX.

The really painful part of JavaFX currently is based on two items:
  1. No table (grid) component.
  2. No data providers to make binding to a database easy.
The result is a nearly useless framework for business developers who don't need shiny new baubles. I need Swing to work.

I am not the only person who feels this way. Fabrizio Giudici has created a project on Kenai.com to address the shortcomings: Better Beans Binding. He took the original JSR-295 code and forked it to create the new project. The package names have remained the same to allow a drop in replacement for the current beans binding framework without breaking anything. I am excited that Fabrizio has decided to do this project. I am hopeful that others wil join the project and make "better beans binding" a reality for the business users and others who need to make Swing just work.

Tuesday, September 08, 2009

OpenSolaris 2009.06 Update

Today I performed an update of my OpenSolaris 2009.06. It went perfectly. It is fascinating that I performed the update which also included a new boot environment without a hitch.

I performed a similar update to my MacBook Pro with OS X Snow Leopard, and was a lot less successful. In the Snow Leopard update, a number of my Java applications do not work now because Apple changed the packages (not names) of the GUI components. Also, the WiFi would not work. Since the introduction of the iPhone, Apple has lost some of its edge on OS X development. Don't get me wrong, I have an iPhone and love it, but Apple seems to spend more time on its development rather than core OS. I state this in spite of the claims its focus for 10.6.