# Beginners

**URL:** https://discourse.processing.org/c/processing/processing-beginners/14.md?page=27

[Latest](https://discourse.processing.org/latest.md) · [Categories](https://discourse.processing.org/categories.md) · [Tags](https://discourse.processing.org/tags.md)

**Page:** 28

---

## [NullPointerException help](https://discourse.processing.org/t/nullpointerexception-help/21044)

<div class="topic-metadata">

**Author:** [@Dylan](https://discourse.processing.org/u/Dylan)\
**Replies:** 2\
**Last updated:** [May 19, 2020, 7:14am UTC](https://discourse.processing.org/t/nullpointerexception-help/21044 "2020-05-19T07:14:56Z")

</div>

When I go to run my code String\[\] names = { "CyberTruck", "Ford F10", "Ranger", "Sierra", "Titan" }; int nt = names.length; int nb = nt + 2; int b1 = nt, b2=nt+1; float track= 200, trackY = 150, trackDY=100; float sta…

---

## [Constant ellipse when mouse clicked](https://discourse.processing.org/t/constant-ellipse-when-mouse-clicked/21014)

<div class="topic-metadata">

**Author:** [@Casto92i](https://discourse.processing.org/u/Casto92i)\
**Replies:** 1\
**Last updated:** [May 18, 2020, 1:15pm UTC](https://discourse.processing.org/t/constant-ellipse-when-mouse-clicked/21014 "2020-05-18T13:15:37Z")

</div>

void mousePressed(){ ellipse(Projpos.x, Projpos.y, 100, 100); } Hi, i have a problem where i’d like to spawn an ellipse each time the mouse is pressed but when i pressed my mouse an ellipse spawn just for 1 second

---

## [Just a Small Question: Load path](https://discourse.processing.org/t/just-a-small-question-load-path/20814)

<div class="topic-metadata">

**Author:** [@HumanoidX](https://discourse.processing.org/u/HumanoidX)\
**Replies:** 4\
**Last updated:** [May 15, 2020, 5:45am UTC](https://discourse.processing.org/t/just-a-small-question-load-path/20814 "2020-05-15T05:45:36Z")

</div>

Hi everyone, is there a way that I can load a file in a folder? for example: randomString = loadString("somerandomfolder\\anotherrandomfolder\\finallythestringiwant.txt"); Just like Minecraft data files, there is a lo…

---

## [Constructor to create a new class instance by assignment](https://discourse.processing.org/t/constructor-to-create-a-new-class-instance-by-assignment/20803)

<div class="topic-metadata">

**Author:** [@ddownn](https://discourse.processing.org/u/ddownn)\
**Replies:** 15\
**Last updated:** [May 14, 2020, 12:43pm UTC](https://discourse.processing.org/t/constructor-to-create-a-new-class-instance-by-assignment/20803 "2020-05-14T12:43:12Z")

</div>

I was hoping I could create a new class instance by assignment like this: innerRect = new Rect(outside.insetBy(m2, m2)); Is there any way to let a class have an constructor that can take an instance of the same type? O…

---

## [Concat with an object not working](https://discourse.processing.org/t/concat-with-an-object-not-working/20632)

<div class="topic-metadata">

**Author:** [@Eyetoof](https://discourse.processing.org/u/Eyetoof)\
**Replies:** 4\
**Last updated:** [May 11, 2020, 10:58pm UTC](https://discourse.processing.org/t/concat-with-an-object-not-working/20632 "2020-05-11T22:58:02Z")

</div>

I’ve stripped the issue I am having down to isolate the issue. I figure its just a data type issue and I should maybe switch to ArrayLists but… I wanted to see if anyone had a specific insight. First off here is what I…

---

## ["Create font" not find new font](https://discourse.processing.org/t/create-font-not-find-new-font/18006)

<div class="topic-metadata">

**Author:** [@Naik\_Trofimov](https://discourse.processing.org/u/Naik_Trofimov)\
**Replies:** 6\
**Last updated:** [May 10, 2020, 8:48pm UTC](https://discourse.processing.org/t/create-font-not-find-new-font/18006 "2020-05-10T20:48:22Z")

</div>

Downloaded new and install new ttf font, but processing dont see he! Haw I do using .ttf font in processing? and: image|690x475 and:

---

## [Trying to limit println()](https://discourse.processing.org/t/trying-to-limit-println/20379)

<div class="topic-metadata">

**Author:** [@Adi](https://discourse.processing.org/u/Adi)\
**Replies:** 5\
**Last updated:** [May 3, 2020, 8:23am UTC](https://discourse.processing.org/t/trying-to-limit-println/20379 "2020-05-03T08:23:08Z")

</div>

I am trying to run println(); once in an if statement, the if statement can be true for many frames, but the print(); should only run once. Many thanks, Adi

---

## [Character array question](https://discourse.processing.org/t/character-array-question/20008)

<div class="topic-metadata">

**Author:** [@dauwpunt](https://discourse.processing.org/u/dauwpunt)\
**Replies:** 4\
**Last updated:** [April 21, 2020, 8:01pm UTC](https://discourse.processing.org/t/character-array-question/20008 "2020-04-21T20:01:54Z")

</div>

Hi there, I’ve got a (hopefully easy) question regarding an array of characters/symbols that represent text. Like I have it below it doesn’t allow for one of the elements to be ‘F#’ (or anything with more than 1 symbol).…

---

## [Declaring Statements for Arrays](https://discourse.processing.org/t/declaring-statements-for-arrays/19984)

<div class="topic-metadata">

**Author:** [@confusedstudent](https://discourse.processing.org/u/confusedstudent)\
**Replies:** 2\
**Last updated:** [April 21, 2020, 12:37pm UTC](https://discourse.processing.org/t/declaring-statements-for-arrays/19984 "2020-04-21T12:37:50Z")

</div>

How would I write the declaration statement for an array with 30 integers, Would this be how? int\[\] arr = new int\[30\]; int min = arr\[0\]; int max = arr\[29\];

---

## [Question: Index Values of Arrays](https://discourse.processing.org/t/question-index-values-of-arrays/19975)

<div class="topic-metadata">

**Author:** [@confusedstudent](https://discourse.processing.org/u/confusedstudent)\
**Replies:** 1\
**Last updated:** [April 20, 2020, 9:15pm UTC](https://discourse.processing.org/t/question-index-values-of-arrays/19975 "2020-04-20T21:15:18Z")

</div>

I was just wondering, if I have an array with 1,000 elements, what is the range of index values for that array?

---

## [Is there any way to split a string into an array of characters?](https://discourse.processing.org/t/is-there-any-way-to-split-a-string-into-an-array-of-characters/19521)

<div class="topic-metadata">

**Author:** [@Math\_Machine](https://discourse.processing.org/u/Math_Machine)\
**Replies:** 8\
**Last updated:** [April 20, 2020, 5:31pm UTC](https://discourse.processing.org/t/is-there-any-way-to-split-a-string-into-an-array-of-characters/19521 "2020-04-20T17:31:38Z")

</div>

Is there any way that I can split up a string into an array of its individual components? Like, for example, if I had the string “hello?”, is there any way I could convert that into an array in the form {“h”,“e”,“l”,“l”…

---

## [Is there a library that allows for the convenient use of doubles?](https://discourse.processing.org/t/is-there-a-library-that-allows-for-the-convenient-use-of-doubles/19532)

<div class="topic-metadata">

**Author:** [@Math\_Machine](https://discourse.processing.org/u/Math_Machine)\
**Replies:** 21\
**Last updated:** [April 20, 2020, 10:44am UTC](https://discourse.processing.org/t/is-there-a-library-that-allows-for-the-convenient-use-of-doubles/19532 "2020-04-20T10:44:36Z")

</div>

So, from what I understand, processing functions aren’t built to handle double floating points. Are there any external libraries I can download that can overload functions so they can handle doubles? Or is there no rea…

---

## [What are PConstants](https://discourse.processing.org/t/what-are-pconstants/19923)

<div class="topic-metadata">

**Author:** [@Ruchi](https://discourse.processing.org/u/Ruchi)\
**Replies:** 1\
**Last updated:** [April 19, 2020, 8:56am UTC](https://discourse.processing.org/t/what-are-pconstants/19923 "2020-04-19T08:56:39Z")

</div>

I am sorry if this is very trivial to ask. I couldn’t find a satisfactory definition on java sites.What are they & why are they used in begin shapes for eg beginShape(PConstants.TRIANGLES).?

---

## [Sending an exit (return) code](https://discourse.processing.org/t/sending-an-exit-return-code/19879)

<div class="topic-metadata">

**Author:** [@rhole](https://discourse.processing.org/u/rhole)\
**Replies:** 8\
**Last updated:** [April 18, 2020, 10:04pm UTC](https://discourse.processing.org/t/sending-an-exit-return-code/19879 "2020-04-18T22:04:30Z")

</div>

I have a need for my sketch to exit and provide a return code to the program which invoked it. I envision something like: // program is ready to end if( errorDetected ) exit(1); // for an error exit else exit(0); I…

---

## [Public Class vs Private Class](https://discourse.processing.org/t/public-class-vs-private-class/19666)

<div class="topic-metadata">

**Author:** [@debxyz](https://discourse.processing.org/u/debxyz)\
**Replies:** 10\
**Last updated:** [April 17, 2020, 9:09pm UTC](https://discourse.processing.org/t/public-class-vs-private-class/19666 "2020-04-17T21:09:14Z")

</div>

This is basically a concept question. And I have read the reference entries on the processing site, as well as on stackoverflow site. Is public vs private class a similar concept as with variable scope – global vs loca…

---

## [Button example: overRect() function's width and height variables](https://discourse.processing.org/t/button-example-overrect-functions-width-and-height-variables/19817)

<div class="topic-metadata">

**Author:** [@Leo\_Aguiar](https://discourse.processing.org/u/Leo_Aguiar)\
**Replies:** 2\
**Last updated:** [April 17, 2020, 11:08am UTC](https://discourse.processing.org/t/button-example-overrect-functions-width-and-height-variables/19817 "2020-04-17T11:08:41Z")

</div>

Hi Forum, In the examples included with the Processing IDE and on the Processing Reference online there is an example showing how to code two simple buttons. One button is a rectangle and it uses a custom function calle…

---

## [Using defined colors from an array](https://discourse.processing.org/t/using-defined-colors-from-an-array/19781)

<div class="topic-metadata">

**Author:** [@debxyz](https://discourse.processing.org/u/debxyz)\
**Replies:** 12\
**Last updated:** [April 15, 2020, 12:06am UTC](https://discourse.processing.org/t/using-defined-colors-from-an-array/19781 "2020-04-15T00:06:22Z")

</div>

I am trying to figure out how to access the 5 grays in the array randomly to fill() the arc shape and rectangle. Seems like it should be pretty easy to do but… And haven’t been able to find anything in my books or onli…

---

## [For loop structure for arrays](https://discourse.processing.org/t/for-loop-structure-for-arrays/19250)

<div class="topic-metadata">

**Author:** [@SheCurvesMobius](https://discourse.processing.org/u/SheCurvesMobius)\
**Replies:** 12\
**Last updated:** [April 14, 2020, 10:00pm UTC](https://discourse.processing.org/t/for-loop-structure-for-arrays/19250 "2020-04-14T22:00:42Z")

</div>

Hello, I’m trying to wrap my head around the for loop structure for arrays. Is there a way to assign values to the elements in the array using the array for loop structure: for(int i : arrayName)? I’ve done this but it…

---

## [How to use switch() in a custom function?](https://discourse.processing.org/t/how-to-use-switch-in-a-custom-function/19753)

<div class="topic-metadata">

**Author:** [@codebodger](https://discourse.processing.org/u/codebodger)\
**Replies:** 5\
**Last updated:** [April 14, 2020, 9:40pm UTC](https://discourse.processing.org/t/how-to-use-switch-in-a-custom-function/19753 "2020-04-14T21:40:54Z")

</div>

I need to create a function called tpc, taking in one integer argument, and returning an integer based on a switch function. I have already written the switch function, and it is quite simple. The return function autom…

---

## [Simple ArrayIndex problem](https://discourse.processing.org/t/simple-arrayindex-problem/19434)

<div class="topic-metadata">

**Author:** [@vjjv](https://discourse.processing.org/u/vjjv)\
**Replies:** 8\
**Last updated:** [April 14, 2020, 9:21pm UTC](https://discourse.processing.org/t/simple-arrayindex-problem/19434 "2020-04-14T21:21:20Z")

</div>

Hi! I\`ve a simple problem, but i couldnt find a solution. Im building a function that generate points, and i want to draw a line between those points, building a triangle: float size = 200; ArrayList\<PVector\>positions…

---

## [Make this code better](https://discourse.processing.org/t/make-this-code-better/19770)

<div class="topic-metadata">

**Author:** [@gurki](https://discourse.processing.org/u/gurki)\
**Replies:** 8\
**Last updated:** [April 14, 2020, 7:21pm UTC](https://discourse.processing.org/t/make-this-code-better/19770 "2020-04-14T19:21:28Z")

</div>

Hello again, I made an code for one task of the exam. But it is not 100% correct. Can sameone give me an hint to make this code better? This is the task in the exam ( it is in german); Schreiben Sie zwei Funktionen:…

---

## [Length won't work in a function](https://discourse.processing.org/t/length-wont-work-in-a-function/19780)

<div class="topic-metadata">

**Author:** [@codebodger](https://discourse.processing.org/u/codebodger)\
**Replies:** 2\
**Last updated:** [April 14, 2020, 6:21pm UTC](https://discourse.processing.org/t/length-wont-work-in-a-function/19780 "2020-04-14T18:21:48Z")

</div>

I have a fairly simple custom function. It takes two inputs (an int\[\] and an int) and returns an int\[\]. It takes the length of the int\[\] input, however it gives the error The variable "length" does not exist Here is a…

---

## [Is it possible to run files in the same folder (sketch) separately?](https://discourse.processing.org/t/is-it-possible-to-run-files-in-the-same-folder-sketch-separately/19756)

<div class="topic-metadata">

**Author:** [@codebodger](https://discourse.processing.org/u/codebodger)\
**Replies:** 1\
**Last updated:** [April 13, 2020, 9:43pm UTC](https://discourse.processing.org/t/is-it-possible-to-run-files-in-the-same-folder-sketch-separately/19756 "2020-04-13T21:43:46Z")

</div>

Is it possible to run files in the same folder (sketch) separately? I have two files (\*.pde) in one sketch folder. I need to open them separately and run them separately. Is there a way to do this? If so, what is it? …

---

## [Println the smallest number in the arrays](https://discourse.processing.org/t/println-the-smallest-number-in-the-arrays/19694)

<div class="topic-metadata">

**Author:** [@gurki](https://discourse.processing.org/u/gurki)\
**Replies:** 16\
**Last updated:** [April 13, 2020, 10:39am UTC](https://discourse.processing.org/t/println-the-smallest-number-in-the-arrays/19694 "2020-04-13T10:39:22Z")

</div>

Hello Everyone, I have a problem with this task. The Questin is in german: Schreiben Sie eine FunkQon minAlle(), die zwei Arrays bekommt und die kleinste Zahl aus beiden Arrays zurückgibt. Testen Sie Ihre FunkQon mit …

---

## [Does the function draw() clear the screen?](https://discourse.processing.org/t/does-the-function-draw-clear-the-screen/19614)

<div class="topic-metadata">

**Author:** [@Tauter](https://discourse.processing.org/u/Tauter)\
**Replies:** 6\
**Last updated:** [April 10, 2020, 1:21pm UTC](https://discourse.processing.org/t/does-the-function-draw-clear-the-screen/19614 "2020-04-10T13:21:52Z")

</div>

My teacher said that the draw() method run at many times per second, and it always clear the screen. But it doesn’t seems like it. By his teachings this code should draw nothing as it is run only once. Than it will be e…

---

## [Processing to make 2 array in one](https://discourse.processing.org/t/processing-to-make-2-array-in-one/19587)

<div class="topic-metadata">

**Author:** [@gurki](https://discourse.processing.org/u/gurki)\
**Replies:** 19\
**Last updated:** [April 9, 2020, 10:40pm UTC](https://discourse.processing.org/t/processing-to-make-2-array-in-one/19587 "2020-04-09T22:40:25Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Now I have 2 array int a = { 1, 2, 25 }; int b = { 9, 18 }; I want to make with two of them in one array with a for loop. Can someone sho…

---

## [Get() returns one number in RGB mode?](https://discourse.processing.org/t/get-returns-one-number-in-rgb-mode/19542)

<div class="topic-metadata">

**Author:** [@juanjoc](https://discourse.processing.org/u/juanjoc)\
**Replies:** 2\
**Last updated:** [April 8, 2020, 3:29pm UTC](https://discourse.processing.org/t/get-returns-one-number-in-rgb-mode/19542 "2020-04-08T15:29:44Z")

</div>

Hello everyone. I do not understand why get does not return R, G, B values instead of 1 single signed number. I am trying to get the background color and then create a rect() with the same color (fill(R,G,B)) as the ba…

---

## [How do I use FOR LOOP to move multiple ellipses?](https://discourse.processing.org/t/how-do-i-use-for-loop-to-move-multiple-ellipses/19479)

<div class="topic-metadata">

**Author:** [@TheBlazeinPanther](https://discourse.processing.org/u/TheBlazeinPanther)\
**Replies:** 14\
**Last updated:** [April 7, 2020, 1:27am UTC](https://discourse.processing.org/t/how-do-i-use-for-loop-to-move-multiple-ellipses/19479 "2020-04-07T01:27:51Z")

</div>

First time posting on here, so I’m not sure how everything works. But I’m trying to copy the eye I have already made with a for loop. Earlier I tried to do them all individually but the eyes vanished completely. Not all …

---

## [New to code, need help please!](https://discourse.processing.org/t/new-to-code-need-help-please/19202)

<div class="topic-metadata">

**Author:** [@cakiru](https://discourse.processing.org/u/cakiru)\
**Replies:** 3\
**Last updated:** [April 5, 2020, 7:37pm UTC](https://discourse.processing.org/t/new-to-code-need-help-please/19202 "2020-04-05T19:37:37Z")

</div>

if you could help me , im trying to make a loop rotate by clicking

---

## [Image processing based on mouse position and different window size](https://discourse.processing.org/t/image-processing-based-on-mouse-position-and-different-window-size/19201)

<div class="topic-metadata">

**Author:** [@alex119](https://discourse.processing.org/u/alex119)\
**Replies:** 1\
**Last updated:** [April 5, 2020, 6:05pm UTC](https://discourse.processing.org/t/image-processing-based-on-mouse-position-and-different-window-size/19201 "2020-04-05T18:05:56Z")

</div>

Hell everyone, I am completely new to processing and I’m following the tutorials series. I am at “Images and pixels” tutorial and I made the “Adjusting image brightness” exercise which is based on mouse position. My qu…

[Previous page](https://discourse.processing.org/c/processing/processing-beginners/14.md?page=26)

[Next page](https://discourse.processing.org/c/processing/processing-beginners/14.md?page=28)
