i think u can call the class of one frame window by creating an object in the other frame window....

eg... write a program to display a window which contains a button named "click here" n by clicking it another window ll get opened displaying "hai" message...

windowa.java

windowb.java

i hav attached the program for this...i think this ll help u.. refer to this..

Attachments
import java.awt.*;
import java.awt.event.*;

public class windowa extends Frame implements ActionListener
{

Button b1;

windowa(String name1)
{

super(name1);
setLayout(null);

b1= new Button("Click here");
add(b1);
b1.addActionListener(this);
b1.setBounds(40,60,100,20);

}

public void actionPerformed(ActionEvent e)
{

if(e.getSource()==b1)
{

windowb ob=new windowb("window B");
ob.setSize(300,200);
ob.setLocation(20,20);
ob.setVisible(true);

}

}

public static void main(String args[])
{

windowa ob1=new windowa("window A");
ob1.setSize(1100,700);
ob1.setLocation(70,40);
ob1.setVisible(true);

}
}
import java.awt.*;

public class windowb extends Frame
{
Label l1;

windowb(String name)
{

super(name);
setLayout(null);

l1=new Label("hai");
add(l1);
l1.setBounds(40,60,100,20);
}

}

Is your code working? If not, where are you having problems with?
Also I would suggest, next time, to use the javax.swing.* package (JFrame, JButton, ....)

I want to write java coding perfectly.
I am very interesting in writing program.
I want to use javax.swing.* package(JFrame ,JButton,.............)

We've already seen that the open( ) method of the Window object returns a new Window object representing the newly created window. We've also seen that this new window has an opener property that refers back to the original window. In this way, the two windows can refer to each other, and each can read properties and invoke methods of the other. The same thing is possible with frames. Any frame in a window can refer to any other frame through the use of the frames, parent, and top properties of the Window object.

Every window has a frames property. This property refers to an array of Window objects, each of which represents a frame contained within the window. (If a window does not have any frames, the frames[] array is empty and frames.length is zero.) Thus, a window (or frame) can refer to its first subframe as frames[0], its second subframe as frames[1], and so on. Similarly, JavaScript code running in a window can refer to the third subframe of its second frame like this:

frames[1].frames[2]

This article has been dead for over six months. Start a new discussion instead.