الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

كيف أحدد مركز لوحة الرسم في JCreator

مغلق
بدأه جودي النور في 1 أبريل 2007 · 0 رد · 636 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1

لدي سؤال في الجافا باستخدام برنامج JCreator وهو رسم دوائر داخل بعضها أو مربعات على حسب طلب المستخدم كما في الصور التالية

b126a2f228.gif

756ceeb241.gif

لكن لم أستطع معرفة مركز لوحة الرسم وعندما عملت البرنامج أصبح بالشكل التالي

032747eb9a.gif

56b7cd27a2.gif

وهذا هو السؤال الرئيسي:

Draw 12 concentric circles in the center of a JPanel. The innermost circle should have a radius of 10 pixels, and each successive circle should have a radius of 10 pixels larger than the previous one. Begin by finding the center of the JPanel. To get the upper-left of the comer of a circle, move up one radius and to the left one radius from the comer. The width and height of the bounding rectangle is the diameter of the circle (twice the radius).

NOTE: (he program should ask the user which shape to draw, 1 for circle, and 2 for rectangle. Depend on user choice one of the following draws will be displayed.

الكود موجود في المرفقات

DrawShapes.rar

تم تعديل هذه المشاركة بواسطة جودي النور في 1 أبريل 2007 في 20:41

هذا الموضوع مغلق.

مواضيع مشابهة