如何避免 "the code of method setup() is exceeding 65535" 处理

How to avoid "the code of method setup() is exceeding 65535" on Processing

我对 Processing 完全陌生。我正在使用 C 生成处理代码,基本上有很多:

stroke(213);
fill(213);
rect(300,260,20,20);

我在文件中生成代码,然后将其粘贴到 Processing。不幸的是,这给了我一个错误:"the code of method setup() is exceeding 65535"。我知道这是一个 Java 限制,对此无能为力。

你知道我该如何解决这个问题吗?请告诉我处理代码,因为我对此一无所知。

与其在一个方法中做这么多,不如将工作分解成多个方法,然后从原始方法调用这些方法。

void setup(){
   setupPartOne();
   setupPartTwo();
   //...
}

void setupPartOne(){
   //do stuff
}

void setupPartTwo(){
   //do stuff
}

我很惊讶当你用谷歌搜索你的错误时没有出现答案!