Results 1 to 2 of 2
Thread: Simple Paint program question
- 03-30-2009, 10:13 AM #1
Member
- Join Date
- Mar 2009
- Posts
- 1
- Rep Power
- 0
Simple Paint program question
I'm trying to make a simple paint program. I already have the canvas and the menubar, and I have the options for rectangles and ovals.
Right now I check the mouse and get x,y position data and then draw the corresponding rectangle or oval, depending on which shape is selected.
But the problem is, I want to be able to select my rectangle or oval shape and then move it around the canvas.
What would I need to do in order to do that? Can anyone give me examples?
I would post my code but it's pretty long. :eek:
- 03-30-2009, 08:46 PM #2
Senior Member
- Join Date
- Jul 2008
- Posts
- 125
- Rep Power
- 0
From this, here are some things I know you know.Java Code:Right now I check the mouse and get x,y position data and then draw the corresponding rectangle or oval, depending on which shape is selected.
You know how to make the canvas respond to the mouse.
You know how to record mouse coordinates for each shape.
You should know that you can extend the data structure
that contains the above data to include:
Shape color
Bounding rectangle
Centroid
number id
name
selectedToDrag
and any other data that may or may not be useful.
My first thought was that you should add a bounding box
to your data structure. When your mouse movement
falls within a box, select that object, and create an
algorithm that modifies that object's x y values per
the mouse movement, or arrow keys.
I've done this many times, but I can't afford to spend
any more time on the details beyond this.
Similar Threads
-
Simple Question
By barusk in forum NetworkingReplies: 13Last Post: 03-04-2009, 07:33 PM -
A simple List question
By right2001 in forum New To JavaReplies: 2Last Post: 02-16-2009, 03:37 AM -
just started paint program. am i going the right direction?
By diggitydoggz in forum New To JavaReplies: 3Last Post: 12-31-2008, 05:57 AM -
Simple Method Question
By Froz3n777 in forum New To JavaReplies: 2Last Post: 02-13-2008, 02:39 AM -
Probably a really simple question...
By ibanez270dx in forum New To JavaReplies: 0Last Post: 11-16-2007, 01:27 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks