colorMode throws nullPointerException (java - eclipse)

Hello. I’m coding my project in Eclipse. I’m trying to change the colorMode to HSB:

import processing.core.PApplet;
public void settings(){
public class mySketch extends PApplet{

	public static void main(String[] args) {
		String[] processingArgs = {"MySketch"};
		MySketch mySketch = new MySketch();
		PApplet.runSketch(processingArgs, MySketch);

	public void settings() {

both lines result in a NullPointerException error:

	at mySketch.settings(
	at processing.core.PApplet.handleSettings(
	at processing.core.PApplet.runSketch(
	at mySketch.main(

Thank you

1 Like

What does the g stand for? Is it initialized properly?

It’s the reference to the PApplet’s default PGraphics if I understand the doc correctly

Were you able to resolve this issue?

I believe that you need to manipulate g in setup() – not settings().

Here is the reference for settings():

Define size() in settings. Then g is initialized. Then you can configure it in setup().