Click here to Skip to main content
15,920,708 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, every body!
I'm learning Java. I want to write a program like Paint in Windows. I don't know the way Paint fill color into a bounded-shape (in java certainly). Help me please!
Thank you!
Posted

1 solution

Paint is a pretty basic program, and if you can't figure out a way to mimic, I would suggest taking some classes on programming.

A simple way would be to store an array of colors. Using a multi-dimensional array, you can specify the number of pixels in width, and the number of pixels in height. Then, draw each pixel using the color in the array that matches the row and height number.

Then, allow the user to pick a color, and wherever they click, you change the value in the array that represents which pixel their mouse is over.

In fact, you can probably find a sample program in java with a little research on google.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900