*
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
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
Author

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
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

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


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

Joined: Oct 14, 2005
Posts: 18541
    
    8

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: http://aspose.com/file-tools
 
subject: one click and the whole ROW will be selected
 
Similar Threads
Gridbag Layout
Deleting The Whole Table problem(Index Out Of Bounds)
how to delete a row header
customized pop-up dialog
How to set multiple fonts inJTextArea or JTextPane