java - This is my code to print the jtable on frame -


i added mouselistener select particular row table,the content of row getting printed on console want print content on new frame should this. attached code along screenshot of table. help.

this code.

    final jtable table = new jtable(data, columnnames);     jscrollpane scrollpane = new jscrollpane( table );     cp.add(scrollpane,borderlayout.center);     frame.add(cp);     frame.setsize(300,300);     frame.setdefaultcloseoperation( exit_on_close );     frame.pack();     frame.setvisible(true);     table.addmouselistener(new mouseadapter() {     public void mouseclicked(mouseevent e){          if(e.getclickcount()==1){             jtable target = (jtable)e.getsource();         system.out.println(target);             int row = target.getselectedrow();         system.out.println(row);         object [] rowdata = new object[table.getcolumncount()];         object [] coldata = new object[table.getrowcount()];         for(int j = 0;j < table.getrowcount();j++)             for(int = 0;i < table.getcolumncount();i++)             {                rowdata[i] = table.getvalueat(j, i);                system.out.println(rowdata[i]);              }           }        }     }); } 

first of all, if make graphical interface swing, can't use system.out.print. need set every row in label , print out way. if label can select mouse


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -