SlideShare a Scribd company logo
1 of 14
‫ةةةةة‬
‫ةةةةة‬
‫ةةةةةةةة‬
Basics of Graphics in Java
Swing
•Abstract Window Toolkit (AWT.(
•1996NetscapeIFCInternet Foundation Class
AWT.
•NetscapeSwing.
•AWTSwingSwing
•Swing
•Swing
•Swing
Frames
•Frame
•
•AWTFrameSwingJframeFrame.
•Swing.
•Swing
import javax.swing.*;
class FirstFrame extends JFrame
{public FirstFrame(){
setTitle("");
setSize(800, 600); } }
public class FirstTest{
public static void main(String[] args){
JFrame frame = new FirstFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.show(); } }
2
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class CenteredFrame extends JFrame
{ public CenteredFrame()
{ setTitle ("2");
addWindowListener(new WindowAdapter()
{ public void windowClosing(WindowEvent e)
{ System.exit(0);
}} );
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension d = tk.getScreenSize();
int screenHeight = d.height;
int screenWidth = d.width;
setSize(screenWidth / 2, screenHeight / 2);
setLocation(screenWidth / 4, screenHeight / 4);
Image img = tk.getImage("icon.gif");
setIconImage(img);}}
public class CenteredTest
{ public static void main(String[] args)
{ JFrame frame = new CenteredFrame();
frame.show();
}
}
•JFrame
3
import javax.swing.*;
import java.awt.*;
public class AlqudsHello
{ public static void main(String[] args)
{ AlqudsHelloFrame frame = new AlqudsHelloFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.show();}}
/**A frame that contains a message panel*/
class AlqudsHelloFrame extends JFrame
{public AlqudsHelloFrame()
{setTitle ("");
setSize(WIDTH, HEIGHT);
// add panel to frame
AlqudsHelloPanel panel = new AlqudsHelloPanel();
Container contentPane = getContentPane();
contentPane.add(panel);}
public static final int WIDTH = 300;
public static final int HEIGHT = 200; }
/**A panel that displays a message. */
class AlqudsHelloPanel extends JPanel
{
public void paintComponent(Graphics g)
{
super.paintComponent(g);
g.drawString("Alquds Open University", MESSAGE_X,
MESSAGE_Y);
}
public static final int MESSAGE_X = 75;
public static final int MESSAGE_Y = 100;
}
•
import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;
public class DrawTest
{ public static void main(String[] args)
{DrawFrame frame = new DrawFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.show();}}
/** A frame that contains a panel with drawings*/
class DrawFrame extends JFrame
{public DrawFrame()
{setTitle("Al-Quds Open Univ.: 2-D Graphics Example");
setSize(WIDTH, HEIGHT);
// add panel to frame
DrawPanel panel = new DrawPanel();
Container contentPane = getContentPane();
contentPane.add(panel);}
public static final int WIDTH = 400;
public static final int HEIGHT = 400; }
/** A panel that displays rectangles and ellipses. */
class DrawPanel extends JPanel
{ public void paintComponent(Graphics g)
{ super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
// draw a rectangle
double leftX = 100;
double topY = 100;
double width = 200;
double height = 150;
Rectangle2D rect = new Rectangle2D.Double(leftX, topY, width, height);
g2.draw(rect);
// draw the enclosed ellipse
Ellipse2D ellipse = new Ellipse2D.Double();
ellipse.setFrame(rect);
g2.draw(ellipse);
// draw a diagonal line
g2.draw(new Line2D.Double(leftX, topY, leftX + width, topY + height));
// draw a circle with the same center
double centerX = rect.getCenterX();
double centerY = rect.getCenterY();
double radius = 150;
Ellipse2D circle = new Ellipse2D.Double();
circle.setFrameFromCenter(centerX, centerY,
centerX + radius, centerY + radius);
g2.draw(circle);}}
•

More Related Content

What's hot

個人メモ用(Pythonのexceptionをfromでかく理由)
個人メモ用(Pythonのexceptionをfromでかく理由)個人メモ用(Pythonのexceptionをfromでかく理由)
個人メモ用(Pythonのexceptionをfromでかく理由)KyutatsuNishiura
 
Error and exception in python
Error and exception in pythonError and exception in python
Error and exception in pythonjunnubabu
 
Unit Testing - Nakov's Talk @ VarnaConf 2013
Unit Testing - Nakov's Talk @ VarnaConf 2013Unit Testing - Nakov's Talk @ VarnaConf 2013
Unit Testing - Nakov's Talk @ VarnaConf 2013Svetlin Nakov
 
The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196Mahmoud Samir Fayed
 
03 standard class library
03 standard class library03 standard class library
03 standard class libraryeleksdev
 
Psycopg2 postgres python DDL Operaytions (select , Insert , update, create ta...
Psycopg2 postgres python DDL Operaytions (select , Insert , update, create ta...Psycopg2 postgres python DDL Operaytions (select , Insert , update, create ta...
Psycopg2 postgres python DDL Operaytions (select , Insert , update, create ta...sachin kumar
 
The Ring programming language version 1.8 book - Part 9 of 202
The Ring programming language version 1.8 book - Part 9 of 202The Ring programming language version 1.8 book - Part 9 of 202
The Ring programming language version 1.8 book - Part 9 of 202Mahmoud Samir Fayed
 

What's hot (11)

個人メモ用(Pythonのexceptionをfromでかく理由)
個人メモ用(Pythonのexceptionをfromでかく理由)個人メモ用(Pythonのexceptionをfromでかく理由)
個人メモ用(Pythonのexceptionをfromでかく理由)
 
Error and exception in python
Error and exception in pythonError and exception in python
Error and exception in python
 
7 inheritance
7 inheritance7 inheritance
7 inheritance
 
Unit Testing - Nakov's Talk @ VarnaConf 2013
Unit Testing - Nakov's Talk @ VarnaConf 2013Unit Testing - Nakov's Talk @ VarnaConf 2013
Unit Testing - Nakov's Talk @ VarnaConf 2013
 
TestNG vs Junit
TestNG vs JunitTestNG vs Junit
TestNG vs Junit
 
The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196
 
03 standard class library
03 standard class library03 standard class library
03 standard class library
 
Psycopg2 postgres python DDL Operaytions (select , Insert , update, create ta...
Psycopg2 postgres python DDL Operaytions (select , Insert , update, create ta...Psycopg2 postgres python DDL Operaytions (select , Insert , update, create ta...
Psycopg2 postgres python DDL Operaytions (select , Insert , update, create ta...
 
The Ring programming language version 1.8 book - Part 9 of 202
The Ring programming language version 1.8 book - Part 9 of 202The Ring programming language version 1.8 book - Part 9 of 202
The Ring programming language version 1.8 book - Part 9 of 202
 
Python modules
Python modulesPython modules
Python modules
 
Javascript
JavascriptJavascript
Javascript
 

Similar to شرح مقرر البرمجة 2 لغة جافا - الوحدة التاسعة

Chapter iv(modern gui)
Chapter iv(modern gui)Chapter iv(modern gui)
Chapter iv(modern gui)Chhom Karath
 
jframe, jtextarea and jscrollpane
  jframe, jtextarea and jscrollpane  jframe, jtextarea and jscrollpane
jframe, jtextarea and jscrollpaneMr. Akaash
 
Task Write a Java program to implement a simple graphics editor tha.pdf
Task Write a Java program to implement a simple graphics editor tha.pdfTask Write a Java program to implement a simple graphics editor tha.pdf
Task Write a Java program to implement a simple graphics editor tha.pdfcronkwurphyb44502
 
Graphical User Interface (GUI) - 1
Graphical User Interface (GUI) - 1Graphical User Interface (GUI) - 1
Graphical User Interface (GUI) - 1PRN USM
 
ViewerFrame.java import javax.swing.JFrame;public class Viewer.pdf
ViewerFrame.java import javax.swing.JFrame;public class Viewer.pdfViewerFrame.java import javax.swing.JFrame;public class Viewer.pdf
ViewerFrame.java import javax.swing.JFrame;public class Viewer.pdfannaindustries
 
Java Programs
Java ProgramsJava Programs
Java Programsvvpadhu
 
This is Java,I am currently stumped on how to add a scoreboard for.pdf
This is Java,I am currently stumped on how to add a scoreboard for.pdfThis is Java,I am currently stumped on how to add a scoreboard for.pdf
This is Java,I am currently stumped on how to add a scoreboard for.pdfanjandavid
 
Main class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdfMain class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdfanushkaent7
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsMuhammadTalha436
 
Hi my question pretains to Java programing, What I am creating is a .pdf
Hi my question pretains to Java programing, What I am creating is a .pdfHi my question pretains to Java programing, What I am creating is a .pdf
Hi my question pretains to Java programing, What I am creating is a .pdfeyeonsecuritysystems
 
Logic and Coding of Java Interfaces & Swing Applications
Logic and Coding of Java Interfaces & Swing ApplicationsLogic and Coding of Java Interfaces & Swing Applications
Logic and Coding of Java Interfaces & Swing Applicationskjkleindorfer
 
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxmary772
 
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxmccormicknadine86
 
Greach, GroovyFx Workshop
Greach, GroovyFx WorkshopGreach, GroovyFx Workshop
Greach, GroovyFx WorkshopDierk König
 
import java.awt.FlowLayout;import java.awt.event.KeyEvent;import.pdf
import java.awt.FlowLayout;import java.awt.event.KeyEvent;import.pdfimport java.awt.FlowLayout;import java.awt.event.KeyEvent;import.pdf
import java.awt.FlowLayout;import java.awt.event.KeyEvent;import.pdfgalagirishp
 
Please help!!I wanted to know how to add a high score to this prog.pdf
Please help!!I wanted to know how to add a high score to this prog.pdfPlease help!!I wanted to know how to add a high score to this prog.pdf
Please help!!I wanted to know how to add a high score to this prog.pdfJUSTSTYLISH3B2MOHALI
 

Similar to شرح مقرر البرمجة 2 لغة جافا - الوحدة التاسعة (20)

Chapter iv(modern gui)
Chapter iv(modern gui)Chapter iv(modern gui)
Chapter iv(modern gui)
 
jframe, jtextarea and jscrollpane
  jframe, jtextarea and jscrollpane  jframe, jtextarea and jscrollpane
jframe, jtextarea and jscrollpane
 
SWING.pptx
SWING.pptxSWING.pptx
SWING.pptx
 
Lecture7 oopj
Lecture7 oopjLecture7 oopj
Lecture7 oopj
 
Task Write a Java program to implement a simple graphics editor tha.pdf
Task Write a Java program to implement a simple graphics editor tha.pdfTask Write a Java program to implement a simple graphics editor tha.pdf
Task Write a Java program to implement a simple graphics editor tha.pdf
 
Graphical User Interface (GUI) - 1
Graphical User Interface (GUI) - 1Graphical User Interface (GUI) - 1
Graphical User Interface (GUI) - 1
 
ViewerFrame.java import javax.swing.JFrame;public class Viewer.pdf
ViewerFrame.java import javax.swing.JFrame;public class Viewer.pdfViewerFrame.java import javax.swing.JFrame;public class Viewer.pdf
ViewerFrame.java import javax.swing.JFrame;public class Viewer.pdf
 
Java Programs
Java ProgramsJava Programs
Java Programs
 
Java oops features
Java oops featuresJava oops features
Java oops features
 
This is Java,I am currently stumped on how to add a scoreboard for.pdf
This is Java,I am currently stumped on how to add a scoreboard for.pdfThis is Java,I am currently stumped on how to add a scoreboard for.pdf
This is Java,I am currently stumped on how to add a scoreboard for.pdf
 
Main class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdfMain class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdf
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ Exams
 
Hi my question pretains to Java programing, What I am creating is a .pdf
Hi my question pretains to Java programing, What I am creating is a .pdfHi my question pretains to Java programing, What I am creating is a .pdf
Hi my question pretains to Java programing, What I am creating is a .pdf
 
Logic and Coding of Java Interfaces & Swing Applications
Logic and Coding of Java Interfaces & Swing ApplicationsLogic and Coding of Java Interfaces & Swing Applications
Logic and Coding of Java Interfaces & Swing Applications
 
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
 
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
 
Greach, GroovyFx Workshop
Greach, GroovyFx WorkshopGreach, GroovyFx Workshop
Greach, GroovyFx Workshop
 
import java.awt.FlowLayout;import java.awt.event.KeyEvent;import.pdf
import java.awt.FlowLayout;import java.awt.event.KeyEvent;import.pdfimport java.awt.FlowLayout;import java.awt.event.KeyEvent;import.pdf
import java.awt.FlowLayout;import java.awt.event.KeyEvent;import.pdf
 
Griffon @ Svwjug
Griffon @ SvwjugGriffon @ Svwjug
Griffon @ Svwjug
 
Please help!!I wanted to know how to add a high score to this prog.pdf
Please help!!I wanted to know how to add a high score to this prog.pdfPlease help!!I wanted to know how to add a high score to this prog.pdf
Please help!!I wanted to know how to add a high score to this prog.pdf
 

More from جامعة القدس المفتوحة

كتاب: Simply AVR مقدمة مبسطة عن النظم المدمجة
كتاب: Simply AVR مقدمة مبسطة عن النظم المدمجةكتاب: Simply AVR مقدمة مبسطة عن النظم المدمجة
كتاب: Simply AVR مقدمة مبسطة عن النظم المدمجةجامعة القدس المفتوحة
 
ملخص تحليل الانظمة وتصميمها - الوحدة السادسة
ملخص تحليل الانظمة وتصميمها - الوحدة السادسةملخص تحليل الانظمة وتصميمها - الوحدة السادسة
ملخص تحليل الانظمة وتصميمها - الوحدة السادسةجامعة القدس المفتوحة
 
ملخص تحليل الانظمة وتصميمها - الوحدة الخامسة
ملخص تحليل الانظمة وتصميمها - الوحدة الخامسةملخص تحليل الانظمة وتصميمها - الوحدة الخامسة
ملخص تحليل الانظمة وتصميمها - الوحدة الخامسةجامعة القدس المفتوحة
 
ملخص تحليل الانظمة وتصميمها - الوحدة الثالثة
ملخص تحليل الانظمة وتصميمها - الوحدة الثالثةملخص تحليل الانظمة وتصميمها - الوحدة الثالثة
ملخص تحليل الانظمة وتصميمها - الوحدة الثالثةجامعة القدس المفتوحة
 
ملخص تحليل الانظمة وتصميمها - الوحدة الثامنة
ملخص تحليل الانظمة وتصميمها - الوحدة الثامنةملخص تحليل الانظمة وتصميمها - الوحدة الثامنة
ملخص تحليل الانظمة وتصميمها - الوحدة الثامنةجامعة القدس المفتوحة
 
ملخص تحليل الانظمة وتصميمها - الوحدة السابعة
ملخص تحليل الانظمة وتصميمها - الوحدة السابعةملخص تحليل الانظمة وتصميمها - الوحدة السابعة
ملخص تحليل الانظمة وتصميمها - الوحدة السابعةجامعة القدس المفتوحة
 
ملخص تحليل الانظمة وتصميمها - الوحدة الرابعة
ملخص تحليل الانظمة وتصميمها - الوحدة الرابعةملخص تحليل الانظمة وتصميمها - الوحدة الرابعة
ملخص تحليل الانظمة وتصميمها - الوحدة الرابعةجامعة القدس المفتوحة
 
ملخص تحليل الانظمة وتصميمها - الوحدة التاسعة
ملخص تحليل الانظمة وتصميمها - الوحدة التاسعةملخص تحليل الانظمة وتصميمها - الوحدة التاسعة
ملخص تحليل الانظمة وتصميمها - الوحدة التاسعةجامعة القدس المفتوحة
 
ملخص تحليل الانظمة وتصميمها - الوحدة الثانية
ملخص تحليل الانظمة وتصميمها - الوحدة الثانيةملخص تحليل الانظمة وتصميمها - الوحدة الثانية
ملخص تحليل الانظمة وتصميمها - الوحدة الثانيةجامعة القدس المفتوحة
 
ملخص تقنية تصميم صفحات الويب - الوحدة السادسة
ملخص تقنية تصميم صفحات الويب - الوحدة السادسةملخص تقنية تصميم صفحات الويب - الوحدة السادسة
ملخص تقنية تصميم صفحات الويب - الوحدة السادسةجامعة القدس المفتوحة
 
ملخص تقنية تصميم صفحات الويب - الوحدة الخامسة
ملخص تقنية تصميم صفحات الويب - الوحدة الخامسةملخص تقنية تصميم صفحات الويب - الوحدة الخامسة
ملخص تقنية تصميم صفحات الويب - الوحدة الخامسةجامعة القدس المفتوحة
 
اسئلة نهائية لمقرر تقنية تصميم صفحات الويب - 1266
اسئلة نهائية لمقرر تقنية تصميم صفحات الويب - 1266اسئلة نهائية لمقرر تقنية تصميم صفحات الويب - 1266
اسئلة نهائية لمقرر تقنية تصميم صفحات الويب - 1266جامعة القدس المفتوحة
 
مناهج البحث العلمي - اللقاء الافتراضي الثاني
مناهج البحث العلمي - اللقاء الافتراضي الثانيمناهج البحث العلمي - اللقاء الافتراضي الثاني
مناهج البحث العلمي - اللقاء الافتراضي الثانيجامعة القدس المفتوحة
 
مناهج البحث العلمي - اللقاء الافتراضي الاول
مناهج البحث العلمي - اللقاء الافتراضي الاولمناهج البحث العلمي - اللقاء الافتراضي الاول
مناهج البحث العلمي - اللقاء الافتراضي الاولجامعة القدس المفتوحة
 

More from جامعة القدس المفتوحة (20)

كتاب ميكروبيديا Micropedia
كتاب ميكروبيديا Micropediaكتاب ميكروبيديا Micropedia
كتاب ميكروبيديا Micropedia
 
كتاب: Simply AVR مقدمة مبسطة عن النظم المدمجة
كتاب: Simply AVR مقدمة مبسطة عن النظم المدمجةكتاب: Simply AVR مقدمة مبسطة عن النظم المدمجة
كتاب: Simply AVR مقدمة مبسطة عن النظم المدمجة
 
ملخص تحليل الانظمة وتصميمها - النصفي
ملخص تحليل الانظمة وتصميمها - النصفيملخص تحليل الانظمة وتصميمها - النصفي
ملخص تحليل الانظمة وتصميمها - النصفي
 
ملخص تحليل الانظمة وتصميمها - الوحدة السادسة
ملخص تحليل الانظمة وتصميمها - الوحدة السادسةملخص تحليل الانظمة وتصميمها - الوحدة السادسة
ملخص تحليل الانظمة وتصميمها - الوحدة السادسة
 
ملخص تحليل الانظمة وتصميمها - الوحدة الخامسة
ملخص تحليل الانظمة وتصميمها - الوحدة الخامسةملخص تحليل الانظمة وتصميمها - الوحدة الخامسة
ملخص تحليل الانظمة وتصميمها - الوحدة الخامسة
 
ملخص تحليل الانظمة وتصميمها - الوحدة الثالثة
ملخص تحليل الانظمة وتصميمها - الوحدة الثالثةملخص تحليل الانظمة وتصميمها - الوحدة الثالثة
ملخص تحليل الانظمة وتصميمها - الوحدة الثالثة
 
ملخص تحليل الانظمة وتصميمها - الوحدة الثامنة
ملخص تحليل الانظمة وتصميمها - الوحدة الثامنةملخص تحليل الانظمة وتصميمها - الوحدة الثامنة
ملخص تحليل الانظمة وتصميمها - الوحدة الثامنة
 
ملخص تحليل الانظمة وتصميمها - الوحدة السابعة
ملخص تحليل الانظمة وتصميمها - الوحدة السابعةملخص تحليل الانظمة وتصميمها - الوحدة السابعة
ملخص تحليل الانظمة وتصميمها - الوحدة السابعة
 
ملخص تحليل الانظمة وتصميمها - الوحدة الرابعة
ملخص تحليل الانظمة وتصميمها - الوحدة الرابعةملخص تحليل الانظمة وتصميمها - الوحدة الرابعة
ملخص تحليل الانظمة وتصميمها - الوحدة الرابعة
 
ملخص تحليل الانظمة وتصميمها - الوحدة التاسعة
ملخص تحليل الانظمة وتصميمها - الوحدة التاسعةملخص تحليل الانظمة وتصميمها - الوحدة التاسعة
ملخص تحليل الانظمة وتصميمها - الوحدة التاسعة
 
ملخص تحليل الانظمة وتصميمها - الوحدة الثانية
ملخص تحليل الانظمة وتصميمها - الوحدة الثانيةملخص تحليل الانظمة وتصميمها - الوحدة الثانية
ملخص تحليل الانظمة وتصميمها - الوحدة الثانية
 
ملخص تقنية تصميم صفحات الويب - الوحدة السادسة
ملخص تقنية تصميم صفحات الويب - الوحدة السادسةملخص تقنية تصميم صفحات الويب - الوحدة السادسة
ملخص تقنية تصميم صفحات الويب - الوحدة السادسة
 
ملخص تقنية تصميم صفحات الويب - الوحدة الخامسة
ملخص تقنية تصميم صفحات الويب - الوحدة الخامسةملخص تقنية تصميم صفحات الويب - الوحدة الخامسة
ملخص تقنية تصميم صفحات الويب - الوحدة الخامسة
 
اسئلة نهائية لمقرر تقنية تصميم صفحات الويب - 1266
اسئلة نهائية لمقرر تقنية تصميم صفحات الويب - 1266اسئلة نهائية لمقرر تقنية تصميم صفحات الويب - 1266
اسئلة نهائية لمقرر تقنية تصميم صفحات الويب - 1266
 
مناهج البحث العلمي - اللقاء الافتراضي الثاني
مناهج البحث العلمي - اللقاء الافتراضي الثانيمناهج البحث العلمي - اللقاء الافتراضي الثاني
مناهج البحث العلمي - اللقاء الافتراضي الثاني
 
مناهج البحث العلمي - شرح الوحدات 1-5
مناهج البحث العلمي - شرح الوحدات 1-5مناهج البحث العلمي - شرح الوحدات 1-5
مناهج البحث العلمي - شرح الوحدات 1-5
 
ملخص مناهج البحث العلمي كامل
ملخص مناهج البحث العلمي كاململخص مناهج البحث العلمي كامل
ملخص مناهج البحث العلمي كامل
 
ملخص مناهج البحث العلمي
ملخص مناهج البحث العلميملخص مناهج البحث العلمي
ملخص مناهج البحث العلمي
 
مناهج البحث العلمي - اللقاء الافتراضي الاول
مناهج البحث العلمي - اللقاء الافتراضي الاولمناهج البحث العلمي - اللقاء الافتراضي الاول
مناهج البحث العلمي - اللقاء الافتراضي الاول
 
ملخص تعايش مع التكنولوجيا
ملخص تعايش مع التكنولوجياملخص تعايش مع التكنولوجيا
ملخص تعايش مع التكنولوجيا
 

Recently uploaded

Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 

Recently uploaded (20)

Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 

شرح مقرر البرمجة 2 لغة جافا - الوحدة التاسعة

  • 2. Swing •Abstract Window Toolkit (AWT.( •1996NetscapeIFCInternet Foundation Class AWT. •NetscapeSwing. •AWTSwingSwing
  • 5.
  • 6. import javax.swing.*; class FirstFrame extends JFrame {public FirstFrame(){ setTitle(""); setSize(800, 600); } } public class FirstTest{ public static void main(String[] args){ JFrame frame = new FirstFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.show(); } }
  • 7. 2 import java.awt.*; import java.awt.event.*; import javax.swing.*; class CenteredFrame extends JFrame { public CenteredFrame() { setTitle ("2"); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); }} );
  • 8. Toolkit tk = Toolkit.getDefaultToolkit(); Dimension d = tk.getScreenSize(); int screenHeight = d.height; int screenWidth = d.width; setSize(screenWidth / 2, screenHeight / 2); setLocation(screenWidth / 4, screenHeight / 4); Image img = tk.getImage("icon.gif"); setIconImage(img);}} public class CenteredTest { public static void main(String[] args) { JFrame frame = new CenteredFrame(); frame.show(); } }
  • 10. 3 import javax.swing.*; import java.awt.*; public class AlqudsHello { public static void main(String[] args) { AlqudsHelloFrame frame = new AlqudsHelloFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.show();}} /**A frame that contains a message panel*/ class AlqudsHelloFrame extends JFrame {public AlqudsHelloFrame() {setTitle (""); setSize(WIDTH, HEIGHT); // add panel to frame AlqudsHelloPanel panel = new AlqudsHelloPanel(); Container contentPane = getContentPane(); contentPane.add(panel);} public static final int WIDTH = 300; public static final int HEIGHT = 200; }
  • 11. /**A panel that displays a message. */ class AlqudsHelloPanel extends JPanel { public void paintComponent(Graphics g) { super.paintComponent(g); g.drawString("Alquds Open University", MESSAGE_X, MESSAGE_Y); } public static final int MESSAGE_X = 75; public static final int MESSAGE_Y = 100; }
  • 12. • import java.awt.*; import java.awt.geom.*; import javax.swing.*; public class DrawTest { public static void main(String[] args) {DrawFrame frame = new DrawFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.show();}} /** A frame that contains a panel with drawings*/ class DrawFrame extends JFrame {public DrawFrame() {setTitle("Al-Quds Open Univ.: 2-D Graphics Example"); setSize(WIDTH, HEIGHT); // add panel to frame DrawPanel panel = new DrawPanel(); Container contentPane = getContentPane(); contentPane.add(panel);} public static final int WIDTH = 400; public static final int HEIGHT = 400; }
  • 13. /** A panel that displays rectangles and ellipses. */ class DrawPanel extends JPanel { public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; // draw a rectangle double leftX = 100; double topY = 100; double width = 200; double height = 150; Rectangle2D rect = new Rectangle2D.Double(leftX, topY, width, height); g2.draw(rect); // draw the enclosed ellipse Ellipse2D ellipse = new Ellipse2D.Double(); ellipse.setFrame(rect); g2.draw(ellipse); // draw a diagonal line g2.draw(new Line2D.Double(leftX, topY, leftX + width, topY + height)); // draw a circle with the same center double centerX = rect.getCenterX(); double centerY = rect.getCenterY(); double radius = 150; Ellipse2D circle = new Ellipse2D.Double(); circle.setFrameFromCenter(centerX, centerY, centerX + radius, centerY + radius); g2.draw(circle);}}
  • 14.