• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JTable - selection of a right-click

Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to be able to select a JTable row on a mouse right-click, just as it happens on a mouse left-click, for opening a popup menu. Opening the menu itself is no problem. The problem is that the row is not selected.
How can I do that?
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Amit,
try this code and i think this might help you,
table1.addMouseListener(new MouseAdapter()
public void mouseClicked(MouseEvent me)
if(SwingUtilities.isRightMouseButton(me) == true)
int row = table1.rowAtPoint(me.getPoint());

//your popup menu goes here.
try and let me know,
The harder I work, the luckier I get. -Sam Goldwyn So tiny. - this ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic