title: This is my code to print the jtable on frame
body: <p>I added MouseListener to select a particular row from table,the content of row is getting printed on console but I want to print this content on new frame what should I do for this.
  I attached my code along with the screenshot of the table.
  thanks for help.</p>
  
  <p>This is my code.</p>
  
  <pre><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 &lt; table.getRowCount();j++)
              for(int i = 0;i &lt; table.getColumnCount();i++)
              {
                 rowData[i] = table.getValueAt(j, i);
                 System.out.println(rowData[i]);
               }
            }
         }
      });
  }
  </code></pre>