Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

one click and the whole ROW will be selected

 
jhon max
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


how can I do this? in just one click, one of my desired selected ROW will be selected?

i dont know how to implement this method >> getSelectedRows(), getSelectedColumn
 
Darryl Burke
Bartender
Posts: 5126
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your question is regarding a JTable selection and you post code that deals with an ImageIcon, several menus and who knows what else. Definitely not the best way to get help on a public forum.

Recommended reading:
1. http://mindprod.com/jgloss/sscce.html
2. http://catb.org/~esr/faqs/smart-questions.html
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's right, if you click on the JTable, then the row you clicked on will be selected. But that wasn't your question, was it? You seem to be asking how to make your program do something when a row is selected. If that's your question, then the API documentation for JTable (follow this link) has a link to the JTable tutorial very near the beginning. Follow that and start reading the tutorial. There's a section about "User Selections" which will probably answer your question.
 
jhon max
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I beg your pardon.. im sorry to make the title unclear or irrelevant to the posted code, .. what i want in my JTable is when i click a row, that row will be highlighted, but in this case i have an image Background in my Jtable,
Im having problems with that,

When I tried to remove the background , I can easily do that specific thing that I want, the whole row that I clicked was Highlighted, because of the background I cant see the highlight,
but I need to apply an Image Background in my JTable...

Is there anything to do with TableRenderer?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you've made each cell component transparent, so how do you expect it to show a highlight color?

perhaps changing your prepareRenderer code to set opacity in line with isRowSelected(row), might do what you want
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic