Actually what i want to do is that on a click of a button , the selected row of the jTable increments to next row so that i can fetch that row to play the next song...how can i do that???

Recommended Answers

All 5 Replies

In reposnse to a the buttons actionevent, get the curently selected row's number, add 1, selec that row. See JTable and DefaultListSelectionModel in the API.

now in another action performed of a button i want to get the selected row number so that i can add 1 to it ..plz tell me the function to retrieve the current row number so that i can add 1 to it and i want that selected row to change to next row wen i click d button as well..

Yes but it wont work because it will just play the next song taking in view the selected row but is there a way to change the selected row myself???? then it would work definately!

You want changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)

* toggle: false, extend: false. Clear the previous selection and ensure the new cell is selected.
* toggle: false, extend: true. Extend the previous selection from the anchor to the specified cell, clearing all other selections.
* toggle: true, extend: false. If the specified cell is selected, deselect it. If it is not selected, select it.
* toggle: true, extend: true. Apply the selection state of the anchor to all cells between it and the specified cell.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.