Hi,
I am trying to call another swing frame from my current frame. And after calling second frame i dispose the current frame.
But while second frame comming on the screen, current frame gets dispose and second frame takes some seconds to appear on screen.
So its creating a bad flickering effect on screen and its not suitable for my application.
i want that first frame will call sencond frame and it will not look like second frame is called. I just want to cancel flickering effect.
Here is my source code.
1st Frame:
public class Welcome extends JFrame
{
JFrame f;
JTextArea nameField,nameField1;
JLabel lable;
public Welcome() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, InterruptedException
{
f=new JFrame();
lable.setLayout(null );
/*****heading text WELCOME*****/
nameField = new JTextArea("Welcome");
nameField.setBounds(320,370,650,150);
nameField.setForeground(new Color(6,42,120));
nameField.setFont(new Font("Caladea", Font.BOLD, 55 ));
nameField.setOpaque(false);
nameField.setEditable(false);
nameField1 = new JTextArea("Here");
nameField1.setBounds(170,470,750,150);
nameField1.setForeground(new Color(6,42,120));
nameField1.setFont(new Font("Caladea", Font.BOLD, 55 ));
nameField1.setOpaque(false);
nameField1.setEditable(false);
lable.add(nameField);
lable.add(nameField1);
f.add(lable);
f.setResizable(false);
f.setUndecorated(true);
f.validate();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GraphicsEnvironment.getLocalGraphicsEnvironment(). getDefaultScreenDevice().setFullScreenWindow(f);
f.setVisible(true);
Thread.sleep(3000);
PBEnter pe = new PBEnter();
}
public static void main(String[] args) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, InterruptedException
{
new Welcome();
}
}
2nd Frame:
public class PBEnter {
JFrame f;
JTextArea nameField1,nameField2,nameField3;
JLabel lable;
public PBEnter() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, IOException, InterruptedException
{
f=new JFrame();
nameField1 = new JTextArea("Enter Ur Name");
nameField1.setBounds(200,350,650,150);
nameField1.setForeground(new Color(6,42,120));
nameField1.setFont(new Font("Caladea", Font.BOLD, 50));
nameField1.setOpaque(false);
nameField1.setEditable(false);
nameField2 = new JTextArea("Middle Name");
nameField2.setBounds(230,450,650,150);
nameField2.setForeground(new Color(6,42,120));
nameField2.setFont(new Font("Caladea", Font.BOLD, 50));
nameField2.setOpaque(false);
nameField2.setEditable(false);
nameField3 = new JTextArea("Sirname");
nameField3.setBounds(400,550,650,150);
nameField3.setForeground(new Color(6,42,120));
nameField3.setFont(new Font("Caladea", Font.BOLD, 50));
nameField3.setOpaque(false);
nameField3.setEditable(false);
lable.setLayout(null );
lable.add(nameField1);
lable.add(nameField2);
lable.add(nameField3);
f.add(lable);
f.setResizable(false);
f.setUndecorated(true);
f.validate();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GraphicsEnvironment.getLocalGraphicsEnvironment(). getDefaultScreenDevice().setFullScreenWindow(f);
f.setVisible(true);
Thread.sleep(3000);
Registration r = new Registration();
f.dispose();
}
public static void main(String[] args) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, InterruptedException
{
}
}