GUI in 2Dimensions

Flexing with Swing

Archive for September, 2010

JTable row resizing using ..JxLayer

Posted by Pavan Kumar on September 16, 2010

A common usecase for a JTable is to  manually resize rows .  One  solution  googled was   Make JTable Resizable

It works fine with a couple of drawbacks..

  • If the CellEditor gets activated on mouseMove(as in my application) the mouse events will be consumed by the editor component , and the table mouseListeners(for  Dragging) will Not be notfied.
  • Working around the problem of rowSelection,when resizing ..needed the underlying table to be modified.

This seemed a perfect usecase for JxLayer

  • Get all MouseEvents from any component parented by the underlying Table.
  • Lock the UI on MouseMove & prevent the RowSelection in the table from changing(on mousePressed).

The class RowResizerUI extends LockableUI(from JxLayer) &  provides  row resizing for the underlying table.

Link to Src


Posted in GUI, Java, Swing | 2 Comments »