Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

lost focus in JTable

 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the construction of my table follows this sun java tutorial: i've a custom model and also have two things tutorial refers: a combo inside table cells and also use TableSorter class in order to have sorting.
I use Jtable to display database data, and also use it to have updates, using combo's selected value; i get the selected line, then get the needed values from that row.
what i cant figure out is why i lose focus in selected row (and therefore i cant control my input to updates) when i first click table headers and only after that i select a certain value from a combo: the instant i click combo�s value, row loses focus! - so i'm unable to perform my update, since i ignore my row and its relevant associated data.
i'm using this method to get my row:

how can i turn this around?
TiA
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May be this site can help you...

http://quicktable.org/jtable/quicktablemain.htm
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you, Maryam
from what i saw seems a very usefull link

in my concret case, i tried adding the following code to my linha() method: (following a link's idea)

but i get this error:

java.lang.IllegalArgumentException: Row index out of range


dont know what to do
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
at least i found out the reason of last error msg: when i select the cell, all is fine; but when i open combo and click one item, row loses selection and therefore the error msg
my problem is why does it loses selection
 
And then we all jump out and yell "surprise! we got you this tiny ad!"
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic