Skip to main content

For fun: JXTable rollover used for "mouseOver editing"

No replies

Always on the lookout for cool requirements I re-read a blog at about a fully interactive table (aka "mouseOver
editing") which wants the cell editor to show up if the mouse is
hovering over it.

Couldn't resist a quick try with standard swingx rollover support. It's
doing a very similar thingy as described in the blog, actually start an
edit on mouseOver, but takes only a couple of lines :-) The core is a
custom RolloverController:

<p>    public static class EditingRolloverController extends<br />
RolloverController {</p>
<p>        @Override<br />
        protected void rollover(Point oldLocation, Point newLocation) {<br />
            if ((newLocation == null) || (newLocation.x < 0)<br />
                    || !component.hasFocus()) return;<br />
            component.editCellAt(newLocation.y, newLocation.x);<br />
<p>        /**<br />
         * {@inheritDoc}<br />
         * Overridden to set the surrendersFocus property to true.<br />
         */<br />
        @Override<br />
        public void install(JXTable table) {<br />
            super.install(table);<br />
            table.setSurrendersFocusOnKeystroke(true);<br />
<p>        //----- implements/overrides to do nothing in this context<br />
        ...<br />
<p>// using<br />
RolloverController controller = new EditingRolloverController();<br />

(a runnable example is in my incubator, RolloverExperiments, package

It's nowhere near producation quality having some open issues (f.i.
overall usability - how to select?), of course, but a nice (keep in mind
that I'm biased :-) example of how per-cell rollover support can be
helpful. And made me tinker with my older "live" rollover renderer
experiments (see LiveTaskPaneYY classes) - probably the only way to get
a proper "intermediate" (between a pure dead renderer and a full-fledged
active editor) with fine-grained mouse-control (routing the events just
isnt good enough)


PS: I'm mostly off-line this week, so expect a bit longer reaction times

To unsubscribe, e-mail:
For additional commands, e-mail: