This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes one click and the whole ROW will be selected Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "one click and the whole ROW will be selected" Watch "one click and the whole ROW will be selected" New topic

one click and the whole ROW will be selected

jhon max
Ranch Hand

Joined: Jan 06, 2010
Posts: 45

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

Joined: May 03, 2008
Posts: 5115

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:

luck, db
There are no new questions, but there may be new answers.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

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

Joined: Jan 06, 2010
Posts: 45
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

Joined: Jun 09, 2003
Posts: 4632
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
I agree. Here's the link:
subject: one click and the whole ROW will be selected
It's not a secret anymore!