File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes how to draw rectangle like corelDraw? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to draw rectangle like corelDraw?" Watch "how to draw rectangle like corelDraw?" New topic
Author

how to draw rectangle like corelDraw?

shahidrasul shahid
Ranch Hand

Joined: Jan 28, 2008
Posts: 62
i want to draw a rectangle and also select it also like coreldraw?


any help me.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39541
    
  27
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.


Ping & DNS - updated with new look and Ping home screen widget
shahidrasul shahid
Ranch Hand

Joined: Jan 28, 2008
Posts: 62
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

Joined: Oct 27, 2005
Posts: 19541
    
  16

Please KeepItDown


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
shahidrasul shahid
Ranch Hand

Joined: Jan 28, 2008
Posts: 62
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
Marshal

Joined: Mar 22, 2005
Posts: 39541
    
  27
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

Joined: Jan 28, 2008
Posts: 62
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
Marshal

Joined: Mar 22, 2005
Posts: 39541
    
  27
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to draw rectangle like corelDraw?
 
Similar Threads
How to display components as well as draw?
Storing objects polymorphically in a Figure array
corel draw (desktop publishing) in linux
How to make rectangle drawn to be vissible when a new rectangle is drawn
Saving Applications