Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to draw rectangle like corelDraw?

 
shahidrasul shahid
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to draw a rectangle and also select it also like coreldraw?


any help me.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
select it also like coreldraw?

Can you elaborate what this means? Not everybody knows CorelDraw.

In general, rectangles are drawn using the Graphics.drawRect and fillRect methods, but you probably already knew that.
 
shahidrasul shahid
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I WANT TO TO DRAW A RECTANGLE

I WANT TO SELECT RECTANGLE.
MOVE RECTANGLE TO OTHER SPACE.
RESIZE RECTANGLE (SMALL,LARGE SIZE).
DELETE RECTANGLE (REMOVE RECTANGLE).

ETC.
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please KeepItDown
 
shahidrasul shahid
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am sorry to write in this style....

please help me about my problem

i want to draw a rectangle

then i select rectangle
move rectangle to other space.
resize rectangle (small , large size)
delete rectangle (remove rectangle)

etc.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume you have gotten the drawing of the rectangle working now. Here are some things to consider when implementing the other points:

You need to think of what constitutes "selecting the rectangle" - which events do you need handle, and under which conditions should you consider a rectangle to be "selected"?

You also need to indicate which rectangle is selected - usually that's done by drawing little boxes around the corners and in the middle of the sides.

If you have several rectangles, a click may be targeted at any of them - think about how to choose which of the rectangles should be selected.

If a rectangle is selected, what does the user need to do to delete it? What event(s) do you need to handle for this?

Same for resizing - that generally occurs if a user clicks and drags one of the little boxes around the corners or at the middle of the sides. The corner boxes might allow the user to resize two sides at the same time, while the boxes at the side only allow a single side to be moved.
[ May 27, 2008: Message edited by: Ulf Dittmer ]
 
shahidrasul shahid
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you say right

but your link does not give me any information please tell me
whether i implement all these funtionality in rectangle


i am waiting thanks .
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what you mean by "link" - my post doesn't contain any.

And yes, you need to implement all the items I mentioned. Do you have thoughts on any of them yet?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic