My code below create a new array and sends it to chat(jFrame).
String info1[]=new String[3];
 // username , userid , userid2 are variables
 info1[0]=username4;
 info1[1]=""+userid;
 info1[2]=""+userid2;
 chat.main(info1);
But i need to modify this code to work such a way that it , if the chat jframe was opened, then dont open a new jFrame .But instead open a new tab in chat jframe . The code for chat frame is :
private void formWindowActivated(java.awt.event.WindowEvent evt) {       
  JScrollPane panel2 = new JScrollPane();
  JTextArea ta=new JTextArea("");
  ta.setColumns(30);
  ta.setRows(19);
  panel2.setViewportView(ta);
  jTabbedPane1.add("Hello", panel2);   
}
 
     
     
    