Results 1 to 3 of 3
  1. #1
    Stephen Douglas's Avatar
    Stephen Douglas is offline Senior Member
    Join Date
    Mar 2010
    Posts
    137
    Rep Power
    0

    Question Listening rows in JTable ??

    Actually i am storing "bill" data row-wise of a JTable... so what i want exaclty is that when the user double clicks any of the row. then an another frame is opened that prompts the user to whether print the data of the row (say in any format)... i am pretty much clear of the printing job but how to make the "rows" of the JTable listen the action of the user!

    please suggest.! thnx:)
    The Quieter you become the more you are able to hear !

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,525
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Stephen Douglas View Post
    Actually i am storing "bill" data row-wise of a JTable... so what i want exaclty is that when the user double clicks any of the row. then an another frame is opened that prompts the user to whether print the data of the row (say in any format)... i am pretty much clear of the printing job but how to make the "rows" of the JTable listen the action of the user!

    please suggest.! thnx:)
    Read the API documentation for the ListSelectionModelfor a JTable; you have to register a listener at that object; whenever a row is clicked your listener is notified. It's all in the API documentation; all you have to do is read it.

    kind regards,

    Jos

  3. #3
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,236
    Rep Power
    7

    Default

    when the user double clicks any of the row.
    Use a MouseListener to listen for a mouse double click.

    then an another frame is opened that prompts the user to whether print the data of the row
    Use a JOptionPane for this.

    In both cases you can find working examples in the Swing tutorial. See "How to Write a Mouse Listener" and "How to Make Dialogs".

Similar Threads

  1. Highlight rows of a jtable
    By simmi in forum AWT / Swing
    Replies: 5
    Last Post: 08-20-2009, 01:13 PM
  2. Replies: 0
    Last Post: 01-23-2009, 04:36 PM
  3. JTable in Frame only shows 3 rows
    By Laura Warren in forum New To Java
    Replies: 4
    Last Post: 12-24-2008, 05:48 AM
  4. Deleting All rows in the JTable
    By surot in forum New To Java
    Replies: 1
    Last Post: 04-16-2008, 10:44 AM
  5. display rows in jtable
    By osval in forum AWT / Swing
    Replies: 1
    Last Post: 08-06-2007, 08:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •