setUndecorated conflic with loadLont
in
Programming Questions
•
3 months ago
When I use loadFont there is crash with setUndecorated
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)
I post this problem on Github but Ben Fry think is not a bug, so if any body have an idea to resolve the conflict between setUndecorated and loadFond. The comment of Ben Fry " (...) At the very minimum, this is causing init() to be called twice. But you're also using unsupported/undocumented things (i.e. setUndecorated) that are causing problems. "
So if any body ahave an idea.
Thx
PFont AmericanTypewriter ;
void setup() {
size(300,300) ;
// when I use this void without the setup with :
// public void removeBorder() that's ok,
// but inside the setup and is not public there is problem come too much often
removeBorder() ;
//PROBLEM WHEN THIS LINE IS ACTIVE
AmericanTypewriter=loadFont ("typo/AmericanTypewriter-96.vlw");
}
void removeBorder() {
frame.removeNotify();
frame.setUndecorated(false);
frame.addNotify();
super.init();
}
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)
I post this problem on Github but Ben Fry think is not a bug, so if any body have an idea to resolve the conflict between setUndecorated and loadFond. The comment of Ben Fry " (...) At the very minimum, this is causing init() to be called twice. But you're also using unsupported/undocumented things (i.e. setUndecorated) that are causing problems. "
So if any body ahave an idea.
Thx
PFont AmericanTypewriter ;
void setup() {
size(300,300) ;
// when I use this void without the setup with :
// public void removeBorder() that's ok,
// but inside the setup and is not public there is problem come too much often
removeBorder() ;
//PROBLEM WHEN THIS LINE IS ACTIVE
AmericanTypewriter=loadFont ("typo/AmericanTypewriter-96.vlw");
}
void removeBorder() {
frame.removeNotify();
frame.setUndecorated(false);
frame.addNotify();
super.init();
}
1