aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Help me in getting the value of a cell after editing in Jtable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Help me in getting the value of a cell after editing in Jtable" Watch "Help me in getting the value of a cell after editing in Jtable" New topic
Author

Help me in getting the value of a cell after editing in Jtable

Kushi Gadiparthi
Ranch Hand

Joined: Sep 23, 2010
Posts: 52
Hi All,

Can any one please help me in getting the value of the cell after editing it

My main idea is to update the database after editing a cell in the Jtable,

I am able to edit it with a JTextField but When I am getting the edited value I am getting the error ,

Can you please help me in this,

I am placing my piece of code as follows




here I should get the value when I click on the Update button and should directly update this value to the data base

But I am getting the following error because my edited value is an int and i used JTextField for editing so it takes a String value



Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: empty String
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at java.lang.Double.parseDouble(Unknown Source)
at client.cpm.dailyT8.alarm.CBRCPMDailyT8Update.updateButton_actionPerformed(CBRCPMDailyT8Update.java:108)
at client.cpm.dailyT8.alarm.CBRCPMDailyT8Update.access$0(CBRCPMDailyT8Update.java:102)
at client.cpm.dailyT8.alarm.CBRCPMDailyT8Update$1.actionPerformed(CBRCPMDailyT8Update.java:95)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)



Please help me in this and give an idea and tell me where did I had done a mistake

Thanks in advance,


Jashvika
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2227
    
    8
I don't see any reason to use a custom editor. Just use the default editor. Then when you want data from the table you use:



You may want to read Table Stop Editing to make sure the edited value has been saved to the model.
Kushi Gadiparthi
Ranch Hand

Joined: Sep 23, 2010
Posts: 52
Hello Rob Camick,

Thanks for the quick reply,

I am dipalaying the total code as follows



I am perfectly editing the cell but not getting the edited value,

So will you please give me an idea, because I dont have any idea in this,

Thank you very much,
Kushi Gadiparthi
Ranch Hand

Joined: Sep 23, 2010
Posts: 52
Hello Rob Camick,

Thank you very much for your documentation,

I had been blocked up here

My editing should end as soon as I click on the update button and should get the editing value,

can you please give some example code how to get this,


Thank you very much,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help me in getting the value of a cell after editing in Jtable