Thread: Jtable help

  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Rep Power

    Jtable help

    I have Jtable having employee details. And I want to select some employees from table randomly and assign them them training. How I can select employees randomly from Jtable and extract data.
  2. #2
  3. Daniel Schildsky
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Mar 2004
    KL, Malaysia.
    Rep Power

    Randomly selecting employees

    1. First, call the getModel() method of your JTable to grab the data model backing the display.
    2. Then, use a random number generator to generate some random numbers within the range of 0 to the total row count -1
    3. Using the generated random number, call to getValueAt() or setValueAt() method on your table data model to manipulate/extract data to/from a specific cell.
    When the programming world turns decent, the real world will turn upside down.

IMN logo majestic logo threadwatch logo seochat tools logo