Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

how to check value of cell in JTable

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Jtable and want to check any empty cell on action event of JButton and to set focus on that particular empty cell. if any body encounter with same task please help me out.
Thanks in advance !!!
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Loop thru the rows and columns for table.getModel().getRowCount() and table.getModel().getColumnCount() number of times.

Check the value of each cell with
table.getModel().getValueAt(row,col)

When found
table.setRowSelectionInterval(row,row);
table.setColumnSelectionInterval(col,col);
[ May 16, 2006: Message edited by: Chandra Prakash Baherwani ]
 
prashant gour
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ThnX Chandra Now i am able to check the value at any cell but still i am not able to set focus on that cell. i want to set mouce cursor on that cell .

one more problem when i make any change in cell and focus is still in that cell. value does not set to model. but as i lost the focus from cell, value has been set to model.

so can i set value to model while insert update of cell.

please Help me out
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! 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