Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
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:
Campbell Ritchie
Tim Cooke
paul wheaton
Jeanne Boyarsky
Ron McLeod
Sheriffs:
Paul Clapham
Liutauras Vilda
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Swing / AWT / SWT
jtable right mouse click
Martin Borovnik
Greenhorn
Posts: 8
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi!
how can i set a selection with right mouse click in jtable? it only works with left mouse clicks. my table has single_selection mode.
thx
martin
Tim McGuire
Ranch Hand
Posts: 820
I like...
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
This is the only way I could find to select a row on a right mouse click:
myTable.addMouseListener(new MouseListener(){ public void mouseClicked(MouseEvent e) { // check for right mouse click: if ((e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) { // calculate where we are in the JTable: int y = e.getY(); int row = Math.round(y / myTable.getRowHeight()); // select the row: myTable.setRowSelectionInterval(row,row); } } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } });
Martin Borovnik
Greenhorn
Posts: 8
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi!
thx!
martin
I brought this back from the farm where they grow the tiny ads:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
JTable and popup
The Header Of JTable
JTable
jtable help
JTable - selection of a right-click
More...