G4P > two questions about Gwindow
              in 
             Contributed Library Questions 
              •  
              2 months ago    
            
 
           
             Hi everyone :^) 
            
             
            
            
             
            
            
             
            
            
 
            
           
             I have two questions.
            
            
             First question is :
             
             
              
             
             
              
             
             
              
               
                
               
               
                
              
             
            
            
              I have NPE problem. I've tried to solve by myself. But... 
             
             
              When I start my processing, usually it runs very well, but very very occasionally NPE occurs, not every time. To find the cause of NPE, I've used 
              println
               almost everywhere in my code (I'm not sure whether it's a good way though). Now I guess that it occurs when Gwindow is initializing, because 
              println("after window");
               didn't execute. Is it right? Then what should I do?
             
             
              This 
              createControlWindow() method is located in void setup. 
             
             - void createControlWindow()
 - {
 - int cwHeight = ssh+cwh;
 - println("ccw in : "+ssw+", "+cwHeight);
 - window = new GWindow(this, "ControlWindow", 0, 100, ssw, cwHeight, false, JAVA2D);
 - println("after window");
 - window.setBackground(0);
 - window.addDrawHandler(this, "windowDraw");
 - window.addMouseHandler(this, "windowMouse");
 - println("ccw end");
 - }
 
                ccw in : 1440, 426
               
               
                 java.lang.NullPointerException
                
                
                  at processing.core.PApplet.handleDraw(PApplet.java:2301)
                
                
                  at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:243)
                
                
                  at processing.core.PApplet.run(PApplet.java:2141)
                
                
                  at java.lang.Thread.run(Thread.java:680)
                
               
             Second question is :
            
            
             As I've mentioned above I've used 
             println
              almost everywhere in my code to find the cause of NPE. Then I've found out that 
             windowDraw (DrawHandler of Gwindow is called 'windowDraw'.) executes more often than 
             void draw. Can I make that 
             windowDraw executes only when 
             void draw executes? not more not less.
            
 
            
              
              1  
            
 
            