Note that there are some explanatory texts on larger screens.

plurals
  1. POswing window getting frozen ,not displaying content
    primarykey
    data
    text
    <pre><code>public class Main extends JFrame{ JLabel lb1,lb2,lb3,lb4; Button b,b1; public Main() { setLayout(null); Container c=getContentPane(); setDefaultCloseOperation(EXIT_ON_CLOSE); getContentPane().setBackground(Color.red); setVisible(true); b1=new Button("CONTINUE"); b1.setFont(new Font("Algerian", 1, 20)); b1.setForeground(Color.black); b1.setBounds(550, 480, 200,40); b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { setVisible(false); try { new Frame(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); c.add(b1); setSize(1290,900); } public static void main(String...s) throws InterruptedException { new Main(); } } </code></pre> <p>this is the main class..and this the frame class that it calls..</p> <pre><code>public class Frame extends JFrame{ Frame() throws InterruptedException { JFrame f=new JFrame(); f.setVisible(true); f.setLayout(null); f.setBounds(0,0,200,200); Container p=f.getContentPane(); p.setBackground(Color.GREEN); f.setResizable(false); Thread.sleep(5000); setVisible(false); new Frame1(); } } </code></pre> <p>the main class calls the frame class..that needs to hold for a certain time and then move to another frame.. but what happens is that the main class calls it, the frame appears , but there is no content in it..nothing is displayed.then it moves to frame1()//</p> <p>but if i run like</p> <blockquote> <p>new Frame();</p> </blockquote> <p>then it holds ,shows content , and then moves..</p> <p>so why doesnt it work when Frame() is called by Main() ?</p> <p>even this code doesnt' work ..instead of Thread.sleep()...this way i am not blocking any even thread..am i ?</p> <pre><code>for(double i=0;i&lt;30;i++) { for(double j=0;j&lt;10000;j++) { } } </code></pre> <p>new Frame1();</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload