1
private void tblRoleMouseClicked(java.awt.event.MouseEvent evt)                                     
{                                         
    if(evt.getClickCount() == 2)
    {
        int row = tblRole.getSelectedRow();
        int column = tblRole.getSelectedColumn();
        new ViewStaff().setVisible(true);
    }
}

how to get the data in ViewStaff JFram based on double click in JTable??? After I double clicked to the JTable, then pop out a JFrame. Inside that JFrame, I want to show out the details that I double clicked it...the data inside JTable I already stored in ArrayList.

List<Admin> adminList = new ArrayList<Admin>();
jefferyleo
  • 630
  • 3
  • 17
  • 34
  • `tblRole.getModel()` here you have the model of the `JTable` where the data is stored. – nachokk Jan 24 '14 at 14:20
  • @nachokk But I want to show that selected value in another JFrame to the textbox 1 by 1... – jefferyleo Jan 24 '14 at 14:23
  • 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve). 2) See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/a/9554657/418556) – Andrew Thompson Jan 24 '14 at 14:25
  • Did you create your own `TableModel` extending for example `AbstractTableModel` ? Then there you could provide a method to return for example `((MyTableModel)tblRole.getModel()).getAdmin(tbl.convertRowIndexToModel(tbl.getSelectedRow()))` – nachokk Jan 24 '14 at 14:25
  • 1
    @AndrewThompson it's MCTRE now xD – nachokk Jan 24 '14 at 14:28
  • @nachokk but problem is I don't want to view in table...I want to retrieve back the value that I selected in Jtable into the textbox 1 by 1...is it possible? – jefferyleo Jan 24 '14 at 14:32
  • 1
    nice we chatted here, time to post an SSCCE/MCVE, short, runnable, compilable with hardcoded value for JTable in local variable, otherwise this question isn't answerable, nor from description posted here – mKorbel Jan 24 '14 at 14:44
  • @nachokk Yes, but what will it be *next* week? I'll let it settle in for a while more before I consider changing my copy/paste quote. – Andrew Thompson Jan 24 '14 at 15:08

0 Answers0