The Artima Developer Community
Sponsored Link

Java Answers Forum
How to retain the selected row, in JTable?

2 replies on 1 page. Most recent reply: Mar 22, 2002 10:33 PM by Swaraj

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
Swaraj

Posts: 24
Nickname: swaraj
Registered: Mar, 2002

How to retain the selected row, in JTable? Posted: Mar 19, 2002 12:47 AM
Reply to this message Reply
Advertisement
Hi
I have this typical case, where i populate a JTable based on values fetched from a Database, then i select one of the rows and perform some actions, i have a timertask running which refreshes this table every 25secs. When ever i refresh i am losing my selection and i am not able to reselect again. So How can i retain my selection of the JTable.

Please help
Swaraj


Yousuf

Posts: 19
Nickname: saeed
Registered: Mar, 2002

Re: How to retain the selected row, in JTable? Posted: Mar 22, 2002 2:45 AM
Reply to this message Reply
when you select row, store that row in different variable.After refreshing table ,you will get same value from that variable.Pl note that define that variable globally.
Bye..

Swaraj

Posts: 24
Nickname: swaraj
Registered: Mar, 2002

Re: How to retain the selected row, in JTable? Posted: Mar 22, 2002 10:33 PM
Reply to this message Reply
Hi Yousuf
Thanks for the suggestion but i am storing the variable globally, but while the grid is loaded for the second time there is no method in the JTable class to set the selected row to the same row. Hence the Selection is lost. Is there any round about way to do this?

Please help
Swaraj

Flat View: This topic has 2 replies on 1 page
Topic: Array cell count Previous Topic   Next Topic Topic: Moving from frame to frame

Sponsored Links



Google
  Web Artima.com   

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