This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How to make a custom CellEditor register changes without loss of focus? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to make a custom CellEditor register changes without loss of focus?" Watch "How to make a custom CellEditor register changes without loss of focus?" New topic
Author

How to make a custom CellEditor register changes without loss of focus?

Rachel Swailes
Ranch Hand

Joined: May 18, 2004
Posts: 434
Hi there

I have written my own component that is kind of like a checkbox, called a SelectableComponent. I am busy putting this into various tables and I would like to ask a question about the custom cell editor that I'm using to edit
the component in the table.

To give you a quick overview, the SelectableComponent has two boolean values, isSelectable and isSelected.

If the SelectableComponent.isSelectable() then the renderer shows a checkbox in the table. Else it shows a blank label.

If the SelectableComponent.isSelectable(), then the editor is placed on the cell.

Now the problem I am having is that it is working as far as I can click on the cells to get them to change their value and as I click the checkbox selects and unselects. However, I need this clicking to be registered with another table that tally's totals, and this change at the moment registers only when the row that I am clicking on loses focus.

How can I make this change in selection fire the event without having to lose the focus?

Many kind regards,
Rachel


[ September 30, 2004: Message edited by: Rachel Swailes ]
Don Kiddick
Ranch Hand

Joined: Dec 12, 2002
Posts: 580
something like this might work :



D.
Rachel Swailes
Ranch Hand

Joined: May 18, 2004
Posts: 434
The almighty Don returns!

Thanks for the advice, I'll give it a try and let you know how it goes.

Cheers,
Rachel
Rachel Swailes
Ranch Hand

Joined: May 18, 2004
Posts: 434
Works like a charm!
Don Rules!

Thanks again,
Rachel
Don Kiddick
Ranch Hand

Joined: Dec 12, 2002
Posts: 580
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to make a custom CellEditor register changes without loss of focus?
 
Similar Threads
JTable Question
Urgent help needed..plsss
JTreeTable and custom renderers/editors
TableCellEditor - edit value of last cell before table focus lost
Cross plaftform GUI layout