1.1-Introductie-Programmeren

Generating colors

Difficulty: Filled Filled Filled

Create a program that allows you to set the background color, based on the values of red, green en blue (RGB model) entered by the user.

Besides the RGB values, colors could also be expressed as hexadecimal numbers and just to show you what a method looks like, we have created the convertRGBToHex method that can generate such a code for you. Note that it does not matter that you don’t fully understand the method itself, but have a look at how you could use it (so what needs to go in and what will be the result).

Hint: A Color is also a type of variable in Java that you can use to store a color. There is a SaxionApp method that allows you to enter the rgb values and returns a variable of this type so you can use this to set the backgound color.

Example

Example