
Hi All,
I need to open two windows at a time and need not to access the behind one when I am using the first one. When I am clicking the behind one it?s getting access.It should not get access.How to do this one.Please help me.

1)PassData.java:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class PassData extends JFrame
{
JTextField text;
PassData(){
JLabel l=new JLabel("Name: ");
text=new JTextField(20);
JButton b=new JButton("Send");
setLayout(null);
l.setBounds(10,10,100,20);
text.setBounds(120,10,150,20);
b.setBounds(120,40,80,20);
add(l);
add(text);
add(b);
setVisible(true);
setSize(300,100);
b.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
String value=text.getText();
NextPage page=new NextPage(value);
page.setVisible(true);
setVisible(false);
}
});
}
public static void main(String[] args)
{
new PassData();
}
}
2)NextPage.java:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class NextPage extends JFrame
{
NextPage(String st)
{
setLayout(null);
setDefaultCloseOperation(javax.swing. WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Welcome");
JLabel lab=new JLabel("Welcome "+st);
lab.setBounds(10,10,500,20);
add(lab);
setSize(300, 100);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.