Why does this happen?

Could somebody explain me why my GUI is not updated unless I manually resize it ?

I have the following :


class PruebaJOGL{

          PruebaJOGL(){
           try {
                  frame = new JFrame();
                  frame.getContentPane().setLayout(new BorderLayout());
                  frame.addWindowListener( new MyWindowAdapter() );
                  frame.setSize(640,480);
                  panel = new JOGLPanel();
                  frame.getContentPane().add(panel,BorderLayout.CENTER);
             } catch (Exception e) { e.printStackTrace(); }
        }


       public void start(){
             frame.setVisible(true);
             panel.start();
       }


        public static void main(String[] args){
                PruebaJOGL pea= new PruebaJOGL();
                pea.start();
        }
}

//............


// In     class  JOGLPanel extends JPanel
public void start(){ 
      Runnable run = new Runnable(){
            public void run(){
                  synchronized(lock){
                              JOGLPanel.this.add(canvas,BorderLayout.CENTER);
                              canvas.addGLEventListener(JOGLPanel.this);
                              
                              customAnimator.start();
                              canvas.requestFocus();

                              JOGLPanel.this.setVisible(true);
                              canvas.setVisible(true);
                              
                              JOGLPanel.this.repaint();
                              canvas.repaint();
                                              
                                             // when I call validate() on the top Jframe after this change, the program get stuck
                  }
            }
      };
      SwingUtilities.invokeLater(run);
}


 

Thanks in advance.