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

How To Draw A Point In The Middle By Using Bluej

بدأه banoota في 18 أبريل 2008 · 4 رد · 766 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

how to darw a point in the middle :

أريد أن أرسم نقطة دائريه في وسط الصفحه عن طريق استخدام برنامج

blue j

قمت بعمل كود لرسم النقطة و لكن لم استطع أن أرسمه في الوسط .. فكيف أستطيع أن أجعل هذه النقطةترسم في الوسط

و ما اخطأ في هذا الكووود ..

import java.awt.*;

import java.awt.geom.*;

/**

* A point that can be manipulated and that draws itself on a canvas.

* @author Michael Kolling and David J. Barnes

* Modified by:

*/

public class Point

{

private int diameter;

private int xPosition;

private int yPosition;

private String color;

private boolean isVisible;

/**

* Create a new circle at default position with default color.

*/

public Point(int x, int y)

{

diameter = 4;

xPosition = x;

yPosition = 300-y;

color = "=blue";

makeVisible() ;

}

public void setXPosition (int x)

{

xPosition = x;

}

public void setYPosition (int y)

{

yPosition = y;

}

public int getXPosition (){

return xPosition;

}

public int getYPosition (){

return yPosition;

}

/**

* Make this circle visible. If it was already visible, do nothing.

*/

public void makeVisible()

{

isVisible = true;

draw();

}

/**

* Change the color. Valid colors are "red", "yellow", "blue", "green",

* "magenta" and "black".

*/

public void SetColor(String newColor)

{

color = newColor;

draw();

}

/*

* Draw the circle with current specifications on screen.

*/

private void draw()

{

if(isVisible) {

Canvas canvas = Canvas.getCanvas();

canvas.draw(this, color, new Ellipse2D.Double(xPosition, yPosition,

diameter, diameter));

canvas.wait(10);

}

}

/*

* Erase the circle on screen.

*/

private void erase()

{

if(isVisible) {

Canvas canvas = Canvas.getCanvas();

canvas.erase(this);

}

}

public void PrintData()

{

System.out.println("################# ");

System.out.println(" Point color " + color);

System.out.println(" Point diameter " + diameter);

System.out.println(" Point X Position " + xPosition);

System.out.println(" point Y Position " + yPosition);

System.out.println("################# ");

}

}

أرجووو الإفادة

أختكم :wub:

#2

في البداية بعض الترتيب لو سمحتي

ثانياً ماهي النقطة الدائرية ؟؟؟؟؟

تحياتي

حزمة المحرك الإصدارة 0.8

أي أحد يجد أني ظلمته فليراسلني

وبإذن الله لو كان له حق سيأخذه

728x90.png

#3

اولا

Canvas canvas = Canvas.getCanvas();

هاد الميثود مو موجود بالكلاس فمنين جبتيه :nose_pick:

ثانيا

canvas.draw(this, color, new Ellipse2D.Double(xPosition, yPosition, 
diameter, diameter));

كمان هاد الميثود مو موجود كمان منين جبتيه :angry:

ثالثا :cry:

canvas.wait(10);

وين الاكسبشن :hot:

رابعا

canvas.erase(this);

منين جبتيه

و كمان اذا بدك تشغليه وين الميثود ال main

و سؤالي هو انت بدك ترسمي دائرة داخل فرايم و لا على شاشة الدوس (شاشة ال blue j) :hmm: بتمنى توضحي سؤالك

mofeedchaar@hotmail.com

#4

mofeed chaar

:salam:

شكرا .. و انا اقصد بال Canvas canvas كلاس ثاني عاملتنه عشان تنرسم فيها النقطة فهمت علي

#5

ايواااااااا :unsure: انا اسف على الالتباس لانو في كلاس بالجافا عنده نفس الاسم اذا في مجال حطي الكلاس الثاني مشان نشوف المشكلة و إن شاء الله بحلها لك :cash:

mofeedchaar@hotmail.com

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