Trying to Change the custom Color of a Rectangle made through DragMode and change type of Rectangle

Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

Trying to Change the custom Color of a Rectangle made through DragMode and change type of Rectangle

Hello and good morning to all you kind sirs and madams

What I'm trying to do is basically draw a Rectangle outline through left-click and then dragging the mouse to the size one wants.

After one has created this rectangle, the user can change the color of the rectangle through clicking the 3 sliders found on the top in the program. Upon the change in color, the rectangle should change from "g.drawRect" to "g.fillRect" and use the desired color.

I have the basic outline of the program done, but need help with the last part (the color and changing of the Rectangle type after changing the color)

Thanks for the help in advance!
P.S. If possible, please use the same imported things that I use and try to keep it as simple as possible (Still learning Java)
P.P.S. Is there like a "then" command in Java? Like: after you've done x, do y. That would make this heaps easier.

Re: Trying to Change the custom Color of a Rectangle made through DragMode and change type of Rectangle

Welcome to the forum! Thanks for taking the time to learn how to post code correctly. If you haven't already, please read this topic to learn other useful info for new members.

It almost sounds like you're asking someone to finish it for you, and that's probably why you haven't had much response. We don't do that here. If you can ask specific questions or describe what you're confused about, we can be more helpful.

Re: Trying to Change the custom Color of a Rectangle made through DragMode and change type of Rectangle

Originally Posted by GregBrannon

Welcome to the forum! Thanks for taking the time to learn how to post code correctly. If you haven't already, please read this topic to learn other useful info for new members.

It almost sounds like you're asking someone to finish it for you, and that's probably why you haven't had much response. We don't do that here. If you can ask specific questions or describe what you're confused about, we can be more helpful.

The problem is just that I don't know how to do this and haven't found any other way on the internet to solve this problem.

I've already got the rest down so it isn't finishing, I've just pretty much hit a wall and am asking for directions.
Any chance that somebody could say where I need to look or rather, at what?
It'd be awesome