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

طلب خطوات انشاء برنامج الرسام بالجاافاا

مغلق
بدأه بجادff في 16 مارس 2011 · 1 رد · 488 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

اريد ان اعمل برنامج الرسام من خلال الجافا

ممكن احد يقولي الخطوات بالتفصيل الممل :blush:

وجدت اكواد لكن لم اعرف كيف اطبقهاا بالجافا

import javax.swing.*; // For JPanel, etc.

import java.awt.*; // For Graphics, etc.

import java.awt.geom.*; // For Ellipse2D, etc.

/** An example of drawing/filling shapes with Java2D in Java 1.2.

*

* From tutorial on learning Java2D at

* http://www.apl.jhu.edu/~hall/java/Java2D-Tutorial.html'>http://www.apl.jhu.edu/~hall/java/Java2D-Tutorial.html

*

* 1998 Marty Hall, http://www.apl.jhu.edu/~hall/java/

*/

public class ShapeExample extends JPanel {

private Ellipse2D.Double circle =

new Ellipse2D.Double(10, 10, 350, 350);

private Rectangle2D.Double square =

new Rectangle2D.Double(10, 10, 350, 350);

public void paintComponent(Graphics g) {

clear(g);

Graphics2D g2d = (Graphics2D)g;

g2d.fill(circle);

g2d.draw(square);

}

// super.paintComponent clears offscreen pixmap,

// since we're using double buffering by default.

protected void clear(Graphics g) {

super.paintComponent(g);

}

protected Ellipse2D.Double getCircle() {

return(circle);

}

public static void main(String[] args) {

WindowUtilities.openInJFrame(new ShapeExample(), 380, 400);

}

}

WindowUtilities.java

import javax.swing.*;

import java.awt.*;

/** A few utilities that simplify testing of windows in Swing.

* 1998 Marty Hall, http://www.apl.jhu.edu/~hall/java/

*/

public class WindowUtilities {

/** Tell system to use native look and feel, as in previous

* releases. Metal (Java) LAF is the default otherwise.

*/

public static void setNativeLookAndFeel() {

try {

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

} catch(Exception e) {

System.out.println("Error setting native LAF: " + e);

}

}

/** A simplified way to see a JPanel or other Container.

* Pops up a JFrame with specified Container as the content pane.

*/

public static JFrame openInJFrame(Container content,

int width,

int height,

String title,

Color bgColor) {

JFrame frame = new JFrame(title);

frame.setBackground(bgColor);

content.setBackground(bgColor);

frame.setSize(width, height);

frame.setContentPane(content);

frame.addWindowListener(new ExitListener());

frame.setVisible(true);

return(frame);

}

/** Uses Color.white as the background color. */

public static JFrame openInJFrame(Container content,

int width,

int height,

String title) {

return(openInJFrame(content, width, height, title, Color.white));

}

/** Uses Color.white as the background color, and the

* name of the Container's class as the JFrame title.

*/

public static JFrame openInJFrame(Container content,

int width,

int height) {

return(openInJFrame(content, width, height,

content.getClass().getName(),

Color.white));

}

}

وشكرااا

#2

اسأل اسئلة محددة فقط

وليس شرح برنامج بالكامل

بالتوفيق

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

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

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…