# Processing

**URL:** https://discourse.processing.org/c/processing/6.md?page=166

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

**Page:** 167

---

## [Obfuscating your processing code on your own](https://discourse.processing.org/t/obfuscating-your-processing-code-on-your-own/25811)

<div class="topic-metadata">

**Author:** [@papaboo](https://discourse.processing.org/u/papaboo)\
**Replies:** 11\
**Last updated:** [December 1, 2020, 11:41am UTC](https://discourse.processing.org/t/obfuscating-your-processing-code-on-your-own/25811 "2020-12-01T11:41:43Z")

</div>

I know that anything a machine runs can be decompiled, that’s not what I’m asking. I’d like to find out what could be some good ways to obfuscate the sketch class in the jar file. I’ve searched the forum and found ProG…

---

## [How do I change the color of a rectangle once clicked?](https://discourse.processing.org/t/how-do-i-change-the-color-of-a-rectangle-once-clicked/5536)

<div class="topic-metadata">

**Author:** [@CodingBoy](https://discourse.processing.org/u/CodingBoy)\
**Replies:** 3\
**Last updated:** [December 1, 2020, 12:28am UTC](https://discourse.processing.org/t/how-do-i-change-the-color-of-a-rectangle-once-clicked/5536 "2020-12-01T00:28:01Z")

</div>

Hello! I was trying to create many squares with different colors on them. I succeeded in doing so, but one thing I wanted to do is that once you click on a colored square, the color of that square would change into anoth…

---

## [Binary numbers with length and charAt function](https://discourse.processing.org/t/binary-numbers-with-length-and-charat-function/25817)

<div class="topic-metadata">

**Author:** [@Ellie98](https://discourse.processing.org/u/Ellie98)\
**Replies:** 5\
**Last updated:** [November 30, 2020, 12:56pm UTC](https://discourse.processing.org/t/binary-numbers-with-length-and-charat-function/25817 "2020-11-30T12:56:55Z")

</div>

Hello, I have to get the binary numbers from 0-32. The tutors just gave us the solution by trying, but I didn’t really understand what is happening. Could someone explain this code to me? How am I able to do a loop unt…

---

## [How to change String order and position and keep char order of each String?!](https://discourse.processing.org/t/how-to-change-string-order-and-position-and-keep-char-order-of-each-string/23656)

<div class="topic-metadata">

**Author:** [@lolonulu](https://discourse.processing.org/u/lolonulu)\
**Replies:** 21\
**Last updated:** [November 30, 2020, 6:59pm UTC](https://discourse.processing.org/t/how-to-change-string-order-and-position-and-keep-char-order-of-each-string/23656 "2020-11-30T18:59:29Z")

</div>

Hello, I got some amazing help from the great @jeremydouglass for my sketch, but I am stuck now. Jeremy wrote me this below, but I don’t find the solution to write properly the function he suggested to me. Blockquote …

---

## [mousePressed stays true after any JOptionPane.showMessageDialog](https://discourse.processing.org/t/mousepressed-stays-true-after-any-joptionpane-showmessagedialog/25828)

<div class="topic-metadata">

**Author:** [@RSV](https://discourse.processing.org/u/RSV)\
**Replies:** 1\
**Last updated:** [November 30, 2020, 12:56pm UTC](https://discourse.processing.org/t/mousepressed-stays-true-after-any-joptionpane-showmessagedialog/25828 "2020-11-30T12:56:08Z")

</div>

Hello, I am encountering a problem with one of my programs where I use the JOptionPane.showMessageDialog. After the message dialog the mousePressed stays true causing unwanted actions. code below. Even running the JOp…

---

## [Processing 4 resize()](https://discourse.processing.org/t/processing-4-resize/25812)

<div class="topic-metadata">

**Author:** [@matheplica](https://discourse.processing.org/u/matheplica)\
**Replies:** 3\
**Last updated:** [November 30, 2020, 11:16am UTC](https://discourse.processing.org/t/processing-4-resize/25812 "2020-11-30T11:16:02Z")

</div>

Hi, I’m trying to use resize() in Processing 4: masque.resize(img.width, img.height); But I’ve got this error : RuntimeException: resize() not implemented for this PImage type It’s work fine with 3.5.4, there is a way…

---

## [How to spawn a rectangle when mouse is clicked (however many times you want) and make it do the same functions as my code can](https://discourse.processing.org/t/how-to-spawn-a-rectangle-when-mouse-is-clicked-however-many-times-you-want-and-make-it-do-the-same-functions-as-my-code-can/25820)

<div class="topic-metadata">

**Author:** [@0w3n928](https://discourse.processing.org/u/0w3n928)\
**Replies:** 1\
**Last updated:** [November 30, 2020, 8:35am UTC](https://discourse.processing.org/t/how-to-spawn-a-rectangle-when-mouse-is-clicked-however-many-times-you-want-and-make-it-do-the-same-functions-as-my-code-can/25820 "2020-11-30T08:35:07Z")

</div>

Code: float rectx,recty,xspeed=7,yspeed=7; void setup() { fullScreen(); } void draw() { background(0); rect(rectx,recty,300,150); fill(0,255,0); if(mousePressed==true); rect(recty,rectx,300,150); if(sideCollis…

---

## [Processing Confirmation Window](https://discourse.processing.org/t/processing-confirmation-window/25816)

<div class="topic-metadata">

**Author:** [@Idris](https://discourse.processing.org/u/Idris)\
**Replies:** 1\
**Last updated:** [November 30, 2020, 5:46am UTC](https://discourse.processing.org/t/processing-confirmation-window/25816 "2020-11-30T05:46:13Z")

</div>

Hey guys!. Can you all please help me of how to make a confirmation window before exiting the sketch with the options ‘Yes’ and ‘No’ in Processing 3.0 Java? Here is my simple code: boolean correct\[\] = {false,false}; vo…

---

## [How to move an Object at x and y simultaneously?](https://discourse.processing.org/t/how-to-move-an-object-at-x-and-y-simultaneously/25801)

<div class="topic-metadata">

**Author:** [@corken](https://discourse.processing.org/u/corken)\
**Replies:** 4\
**Last updated:** [November 30, 2020, 1:02am UTC](https://discourse.processing.org/t/how-to-move-an-object-at-x-and-y-simultaneously/25801 "2020-11-30T01:02:03Z")

</div>

Hello I dont quite understand how to move an object on the x and on the y at the same time. It would be nice if someone could give me an example. Also here is the code im working on right now. If you want to correct i…

---

## [A timer which activates by pressing a button](https://discourse.processing.org/t/a-timer-which-activates-by-pressing-a-button/25818)

<div class="topic-metadata">

**Author:** [@thedarklord](https://discourse.processing.org/u/thedarklord)\
**Replies:** 1\
**Last updated:** [November 29, 2020, 11:20pm UTC](https://discourse.processing.org/t/a-timer-which-activates-by-pressing-a-button/25818 "2020-11-29T23:20:42Z")

</div>

I’m trying to make a timer which starts by pressing a button. I’ve tried millis() but it starts counting as soon as I start the program.

---

## [How to animate an Image?](https://discourse.processing.org/t/how-to-animate-an-image/25819)

<div class="topic-metadata">

**Author:** [@corken](https://discourse.processing.org/u/corken)\
**Replies:** 1\
**Last updated:** [November 29, 2020, 10:56pm UTC](https://discourse.processing.org/t/how-to-animate-an-image/25819 "2020-11-29T22:56:03Z")

</div>

Hello, my question is how to animate an moving object. In my code I can move Mario and added the animation. But it is at 60 fps by default so its really fast. When I cap the FPS the animation obviously is slower but als…

---

## [How to sort words alphabetically from a String?](https://discourse.processing.org/t/how-to-sort-words-alphabetically-from-a-string/12767)

<div class="topic-metadata">

**Author:** [@lolonulu](https://discourse.processing.org/u/lolonulu)\
**Replies:** 119\
**Last updated:** [November 29, 2020, 10:26pm UTC](https://discourse.processing.org/t/how-to-sort-words-alphabetically-from-a-string/12767 "2020-11-29T22:26:10Z")

</div>

Hello, The code below compiles, but the way the words are displayed is really strange (last word on the left and then the other words on its right…) how come ?!! I want to sort the words in alphabetical order and chang…

---

## [Calling arraylist object function on entire arraylist](https://discourse.processing.org/t/calling-arraylist-object-function-on-entire-arraylist/25813)

<div class="topic-metadata">

**Author:** [@ScriptKiddie](https://discourse.processing.org/u/ScriptKiddie)\
**Replies:** 1\
**Last updated:** [November 29, 2020, 5:14pm UTC](https://discourse.processing.org/t/calling-arraylist-object-function-on-entire-arraylist/25813 "2020-11-29T17:14:49Z")

</div>

Hi everyone, pseudocode below: class Class { void function() { instruction performed by object; } } ArrayList\<Class\> objectList = new ArrayList(100); for(int i = 0; i \< 100; i++) { objectList.get(i)…

---

## [String to base64 and vice versa](https://discourse.processing.org/t/string-to-base64-and-vice-versa/25690)

<div class="topic-metadata">

**Author:** [@papaboo](https://discourse.processing.org/u/papaboo)\
**Replies:** 4\
**Last updated:** [November 29, 2020, 5:14pm UTC](https://discourse.processing.org/t/string-to-base64-and-vice-versa/25690 "2020-11-29T17:14:45Z")

</div>

Hi, I’ve searched through the forum but seen base64 applied only for images. Is it possible convert a string to base64 and decrypt base64 to plain text? In Javascript I think it’s done with “atob” “btoa”, what about in…

---

## [This ball goes through the rectangle rather than hitting it or bouncing it](https://discourse.processing.org/t/this-ball-goes-through-the-rectangle-rather-than-hitting-it-or-bouncing-it/25783)

<div class="topic-metadata">

**Author:** [@Waka](https://discourse.processing.org/u/Waka)\
**Replies:** 66\
**Last updated:** [November 29, 2020, 5:05pm UTC](https://discourse.processing.org/t/this-ball-goes-through-the-rectangle-rather-than-hitting-it-or-bouncing-it/25783 "2020-11-29T17:05:50Z")

</div>

Hi, Can you please help to make the ball hit the rectangle rather than go through the rectangle float ballx,bally,xspeed=5,yspeed=8; void setup() { size(displayWidth,displayHeight); stroke(255); strokeWeight(100); } v…

---

## [Save when app close, exit() ... stop()](https://discourse.processing.org/t/save-when-app-close-exit-stop/25754)

<div class="topic-metadata">

**Author:** [@matheplica](https://discourse.processing.org/u/matheplica)\
**Replies:** 7\
**Last updated:** [November 29, 2020, 12:25pm UTC](https://discourse.processing.org/t/save-when-app-close-exit-stop/25754 "2020-11-29T12:25:32Z")

</div>

Hi, I’m trying to save data when my app close either with mouse or ESC button. I try with exit() and stop() with any result. this is my code void stop(){ saveSlides(); exit(); } Thanks

---

## [Generative Patterns Processing Poster](https://discourse.processing.org/t/generative-patterns-processing-poster/25721)

<div class="topic-metadata">

**Author:** [@angela1811](https://discourse.processing.org/u/angela1811)\
**Replies:** 14\
**Last updated:** [November 29, 2020, 11:43am UTC](https://discourse.processing.org/t/generative-patterns-processing-poster/25721 "2020-11-29T11:43:28Z")

</div>

Hello everyone, I am a newbie in Processing! I have to submit a project very soon for the final exam at university T^T But it’s so sad I’m stuck with my project. I have to create a programming poster but I’m don’t have…

---

## [How do I change the size of the display window?](https://discourse.processing.org/t/how-do-i-change-the-size-of-the-display-window/25384)

<div class="topic-metadata">

**Author:** [@Math\_Machine](https://discourse.processing.org/u/Math_Machine)\
**Replies:** 27\
**Last updated:** [November 29, 2020, 12:57am UTC](https://discourse.processing.org/t/how-do-i-change-the-size-of-the-display-window/25384 "2020-11-29T00:57:34Z")

</div>

So, I was tampering around with the “setResizable” feature in Processing. I was pretty satisfied with the results, when combined with the “scale” function and the “PMatrix” class, I can basically resize the entire sketc…

---

## [Random() seems to be very biased towards positive numbers. how to mitigate?](https://discourse.processing.org/t/random-seems-to-be-very-biased-towards-positive-numbers-how-to-mitigate/25749)

<div class="topic-metadata">

**Author:** [@exe](https://discourse.processing.org/u/exe)\
**Replies:** 10\
**Last updated:** [November 29, 2020, 12:19am UTC](https://discourse.processing.org/t/random-seems-to-be-very-biased-towards-positive-numbers-how-to-mitigate/25749 "2020-11-29T00:19:09Z")

</div>

My level of expertise is pretty low, I have some mild background in Java and QBasic way back when, and otherwise have learned most of the little I know via Daniel’s YT tuts (of which I’ve still many to go through). But …

---

## [How to extract values from a PVector?](https://discourse.processing.org/t/how-to-extract-values-from-a-pvector/25778)

<div class="topic-metadata">

**Author:** [@laptophead](https://discourse.processing.org/u/laptophead)\
**Replies:** 4\
**Last updated:** [November 28, 2020, 7:17pm UTC](https://discourse.processing.org/t/how-to-extract-values-from-a-pvector/25778 "2020-11-28T19:17:31Z")

</div>

please format code with \</\> button \* homework policy \* asking questions I am using the leapmotion library and some values are coming in a PVector. They print out fine, but when I put them in a string to be sent to A…

---

## [How to make a rectangle spawn when mouseclicked and will bounce](https://discourse.processing.org/t/how-to-make-a-rectangle-spawn-when-mouseclicked-and-will-bounce/25742)

<div class="topic-metadata">

**Author:** [@0w3n928](https://discourse.processing.org/u/0w3n928)\
**Replies:** 2\
**Last updated:** [November 28, 2020, 6:51pm UTC](https://discourse.processing.org/t/how-to-make-a-rectangle-spawn-when-mouseclicked-and-will-bounce/25742 "2020-11-28T18:51:13Z")

</div>

I’m trying to make another rectangle spawn when mouse is clicked once and it will collide to my first bouncing rectangle and I can add however many i want but my code doesn’t even need me to click and it doesn’t really w…

---

## [Random elements different positions](https://discourse.processing.org/t/random-elements-different-positions/16984)

<div class="topic-metadata">

**Author:** [@San](https://discourse.processing.org/u/San)\
**Replies:** 4\
**Last updated:** [November 28, 2020, 6:33pm UTC](https://discourse.processing.org/t/random-elements-different-positions/16984 "2020-11-28T18:33:17Z")

</div>

Hi I want to draw squares on random positions on a grid, but I don’t want to have them on the same position. If I run the code sometimes there are two squares on the same position. I know that it has something to do wit…

---

## [Food Drop from an Airplane](https://discourse.processing.org/t/food-drop-from-an-airplane/25782)

<div class="topic-metadata">

**Author:** [@Elo](https://discourse.processing.org/u/Elo)\
**Replies:** 1\
**Last updated:** [November 28, 2020, 5:36pm UTC](https://discourse.processing.org/t/food-drop-from-an-airplane/25782 "2020-11-28T17:36:43Z")

</div>

I don’t know what I’m doing wrong and I don’t understand processing that well; Can Someone help me fix the issues and bugs in my program \[details=“Summary”\] This text will be hidden //plane coordinates int planeX…

---

## [I am going to do a roll dice game](https://discourse.processing.org/t/i-am-going-to-do-a-roll-dice-game/25780)

<div class="topic-metadata">

**Author:** [@mengtong](https://discourse.processing.org/u/mengtong)\
**Replies:** 2\
**Last updated:** [November 28, 2020, 12:26pm UTC](https://discourse.processing.org/t/i-am-going-to-do-a-roll-dice-game/25780 "2020-11-28T12:26:52Z")

</div>

Here is my code, now I can roll my dice. But I want the only dice or dices I choose to re-roll, others ignore. I didt finish reroll function. I dont know how to do it. Can someone give me some suggest? final int NUM\_SID…

---

## [Index out of bounds](https://discourse.processing.org/t/index-out-of-bounds/25775)

<div class="topic-metadata">

**Author:** [@ScriptKiddie](https://discourse.processing.org/u/ScriptKiddie)\
**Replies:** 4\
**Last updated:** [November 28, 2020, 9:27am UTC](https://discourse.processing.org/t/index-out-of-bounds/25775 "2020-11-28T09:27:30Z")

</div>

Hi everyone, I’m hoping I’m missing something simple here. I want to display an object (which works) and when my player entity collides with this object the object should disappear. My collision code works but once the …

---

## [Transparency in save() function](https://discourse.processing.org/t/transparency-in-save-function/25699)

<div class="topic-metadata">

**Author:** [@yanze03](https://discourse.processing.org/u/yanze03)\
**Replies:** 14\
**Last updated:** [November 28, 2020, 9:22am UTC](https://discourse.processing.org/t/transparency-in-save-function/25699 "2020-11-28T09:22:35Z")

</div>

So I made this code where you can draw and create an image. This works just fine but is it possible to get an image with a transparant background? Is there like a function to remove everything with RGB code white in a ce…

---

## [Decimal into binary numbers](https://discourse.processing.org/t/decimal-into-binary-numbers/25758)

<div class="topic-metadata">

**Author:** [@Ellie98](https://discourse.processing.org/u/Ellie98)\
**Replies:** 2\
**Last updated:** [November 28, 2020, 6:40am UTC](https://discourse.processing.org/t/decimal-into-binary-numbers/25758 "2020-11-28T06:40:54Z")

</div>

Hey, i’m trying to convert the decimal numerbs into binary numbers but I get a lot of zeros in front of the binary numbers. How do I cut of the zeros? Thanks in advance! void setup() { //System.out.printf("Dez -\> Du…

---

## [Trying to understand why a boolean is returning true](https://discourse.processing.org/t/trying-to-understand-why-a-boolean-is-returning-true/25779)

<div class="topic-metadata">

**Author:** [@crimpqwe](https://discourse.processing.org/u/crimpqwe)\
**Replies:** 1\
**Last updated:** [November 28, 2020, 4:49am UTC](https://discourse.processing.org/t/trying-to-understand-why-a-boolean-is-returning-true/25779 "2020-11-28T04:49:12Z")

</div>

import controlP5.\*; boolean button1 = false, button2 = false, button3 = false; ControlP5 cp5; float bg = random(255); void setup() { size(1200, 750); cp5 = new ControlP5(this); cp5.addButton("A") .setPosi…

---

## [Sending data from python to processing](https://discourse.processing.org/t/sending-data-from-python-to-processing/25771)

<div class="topic-metadata">

**Author:** [@arcadeperfect](https://discourse.processing.org/u/arcadeperfect)\
**Replies:** 7\
**Last updated:** [November 27, 2020, 8:41pm UTC](https://discourse.processing.org/t/sending-data-from-python-to-processing/25771 "2020-11-27T20:41:35Z")

</div>

Hi I’m trying to transmit sensor data from a python script to a processing sketch via sockets. On the python side I have: import socket import random HOST = '' # Symbolic name meaning all availabl…

---

## [Expecting EOF, found else](https://discourse.processing.org/t/expecting-eof-found-else/25759)

<div class="topic-metadata">

**Author:** [@muffininwinter](https://discourse.processing.org/u/muffininwinter)\
**Replies:** 2\
**Last updated:** [November 27, 2020, 8:01pm UTC](https://discourse.processing.org/t/expecting-eof-found-else/25759 "2020-11-27T20:01:41Z")

</div>

please format code with \</\> button \* homework policy \* asking questions boolean running = false; PImage imgbk; PImage imgm; PImage albert; PImage imgnote; String\[\] imageNames = { "albert0.jpg", "albert1.jpg" }; PI…

[Previous page](https://discourse.processing.org/c/processing/6.md?page=165)

[Next page](https://discourse.processing.org/c/processing/6.md?page=167)
