The Artima Developer Community
Sponsored Link

Java Answers Forum
JTable and retrieval of values

1 reply on 1 page. Most recent reply: Nov 4, 2002 3:07 AM by twisty

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 1 reply on 1 page
sakthivel

Posts: 7
Nickname: sakthivel
Registered: Oct, 2002

JTable and retrieval of values Posted: Nov 1, 2002 7:43 AM
Reply to this message Reply
Advertisement
Hi there,
I am having a JTable in a JPanel. I am displaying the values in it from the backend. Upto this it is working fine. (I am using DefaultTableModel). My cells are kept editable. I am trying to type something in my cell...it is getting appended.....after that, WITHOUT MOVING THE POINTER TO SOMEOTHER CELL, if i try to collect all the values from the JTable, (using mytablemodel.getDataVector();)....it is giving the old value of that cell....the editted value is not gettting received...but once if i edit and move the cursor to some other cell, i can get the editted value....but how to get the editted(updated) value, without moving the cursor postion???
hope u should have got my question....
waiting for ur reply....
with advance thanx
bye,
Sakthivel S.


twisty

Posts: 22
Nickname: twisty
Registered: Nov, 2002

Re: JTable and retrieval of values Posted: Nov 4, 2002 3:07 AM
Reply to this message Reply
Unfortunately, they didn't automatically enforce a commit with the way Sun programmed it. One workaround I use is to apply a focus listener to the table.

// Add focus listener for JTable to commit edits.
returnsTable.addFocusListener( 
	new FocusListener() {
		public void focusLost( FocusEvent e ) {
			returnsTable.getCellEditor().stopCellEditing();
		}
		public void focusGained( FocusEvent e ) {}
	}
);
java]

Flat View: This topic has 1 reply on 1 page
Topic: Connection to stored procedures from jsp Previous Topic   Next Topic Topic: Problem with charset

Sponsored Links



Google
  Web Artima.com   

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