The Artima Developer Community
Sponsored Link

Java Answers Forum
jtable loosing focus

2 replies on 1 page. Most recent reply: Apr 14, 2004 12:47 AM by Matthias Neumair

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

jtable loosing focus Posted: Apr 7, 2004 1:18 AM
Reply to this message Reply
Advertisement
In my frame I use a standard JTable and a Button wich starts the evaluation of the table.

My problem: if I didn't hit [Return] or change the line/column after editing a value, the table doesn't store the value.

I'd like to use the focus lost event to store the value.
How can I do this?


mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: jtable loosing focus Posted: Apr 12, 2004 12:25 AM
Reply to this message Reply
Call this method at the focus loss event of the cell

 private void closeCellEditors(boolean validate)
   {
	TableCellEditor tce = null;
    	if (_table.isEditing())
   	{
       	    	tce = _table.getCellEditor();
   	}
   	if (tce!=null)
   	{
       		if (validate)
   		{
           		tce.stopCellEditing();
 
       		}
   		else
   		{
           		tce.cancelCellEditing();
       		}
   	}
  }


call closeCellEditors(true);

Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: jtable loosing focus Posted: Apr 14, 2004 12:47 AM
Reply to this message Reply
thanks

Flat View: This topic has 2 replies on 1 page
Topic: Help Me Previous Topic   Next Topic Topic: pass html:errors to one of the frames

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use