Could somebody explain me why my GUI is not updated unless I manually resize it ?
I have the following :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| 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(); } }
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(); } } }; SwingUtilities.invokeLater(run); }
|
Thanks in advance.