This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

how to draw rectangle like corelDraw?  RSS feed

 
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.
 
Rancher
Posts: 42974
76
  • 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.
 
Sheriff
Posts: 21465
97
Chrome Eclipse IDE Java Spring Ubuntu VI Editor 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
Posts: 42974
76
  • 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
Posts: 42974
76
  • 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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!