SlideShare a Scribd company logo
1 of 4
Npm : 201243501190
Nama : Reza Fahlevi
Kelas : R7H
Mata Kuliah : Komputer Grafik
Dosen : Nahot Frastian , M.Kom
Program Studi : Teknik Informatika
Universitas : Universitas Indraprasta Pgri
Program Komputer Grafik :
- Program BasisGrafik
Input :
import java.awt.Graphics ;
import java.awt.Color ;
public class basisgrapik extends java.applet.Applet {
public void paint ( Graphics g ) {
int xpts [] = {5,25,50,30,15,5};
int ypts [] = { 10, 35 ,20 ,65, 40, 10 } ;
g.drawString ( " Java Graphics Basic ",0 , 50 ) ;
g.drawLine (5,100,150,250) ;
g.setColor ( Color.red ) ;
g.drawRect ( 50,100,150,250) ;
g.drawRoundRect ( 50 , 150 , 150,250 , 6 , 12 ) ;
g.drawPolygon ( xpts , ypts , xpts.length ) ;
// Cara Lain Buat Polygon
//Polygon poly = new Polygon (xpts + 100 , ypts+100 , xpts.length ) ;
// g.fillPolygon ( poly);
g.drawOval (150,100,250,55 ) ;
g.drawArc ( 50,100,150,275,95,115);
}
}
Proses :
 drawString : kordinat x nya : 0 dan kordinat Y nya :50 , sedangkan kata String
nya : Java Graphics Basic
 drawLine nya : kordinat x1 nya 5 , x2 nya = 150 , y1 = 100 , y2 = 250
 Lalu warna yang di gunakan adalah warna merah ( setColor )
 drawRect : kordinat x1 nya 50 , x2 nya = 150 , y1 = 100 , y2 = 250
 drawRoundRect x1 = 50 ,int y = 150 , int width = 150 , int height = 250 , int
xdiam=6 , int ydiam = 12
 drawOval : kordinat x1 nya 150 , x2 nya = 250 , y1 = 100 , y2 = 55
 drawArc x1 = 50 ,int y = 100 , int width = 150 , int height = 275 , int
statangle=95 , int arcangle = 15
Output :

More Related Content

What's hot

SPL 10.1 | Manual Tracing on Basic Loop & 1D Array
SPL 10.1 | Manual Tracing on Basic Loop & 1D ArraySPL 10.1 | Manual Tracing on Basic Loop & 1D Array
SPL 10.1 | Manual Tracing on Basic Loop & 1D ArrayMohammad Imam Hossain
 
Dip 5 mathematical preliminaries
Dip 5 mathematical preliminariesDip 5 mathematical preliminaries
Dip 5 mathematical preliminariesManas Mantri
 
Lec23-CS110 Computational Engineering
Lec23-CS110 Computational EngineeringLec23-CS110 Computational Engineering
Lec23-CS110 Computational EngineeringSri Harsha Pamu
 
Csci101 lect08a matlab_programs
Csci101 lect08a matlab_programsCsci101 lect08a matlab_programs
Csci101 lect08a matlab_programsElsayed Hemayed
 
Linear programming assignment help
Linear programming assignment helpLinear programming assignment help
Linear programming assignment helpStatistics Help Desk
 
Programa expresiones regulares
Programa expresiones regularesPrograma expresiones regulares
Programa expresiones regularesAnel Sosa
 
Coding Test Review1
Coding Test Review1Coding Test Review1
Coding Test Review1SEMINARGROOT
 
Line drawing algorithm
Line drawing algorithmLine drawing algorithm
Line drawing algorithmA. S. M. Shafi
 
Linear regression
Linear regression Linear regression
Linear regression mohamed Naas
 

What's hot (13)

SPL 10.1 | Manual Tracing on Basic Loop & 1D Array
SPL 10.1 | Manual Tracing on Basic Loop & 1D ArraySPL 10.1 | Manual Tracing on Basic Loop & 1D Array
SPL 10.1 | Manual Tracing on Basic Loop & 1D Array
 
Dip 5 mathematical preliminaries
Dip 5 mathematical preliminariesDip 5 mathematical preliminaries
Dip 5 mathematical preliminaries
 
Lec23-CS110 Computational Engineering
Lec23-CS110 Computational EngineeringLec23-CS110 Computational Engineering
Lec23-CS110 Computational Engineering
 
Csci101 lect08a matlab_programs
Csci101 lect08a matlab_programsCsci101 lect08a matlab_programs
Csci101 lect08a matlab_programs
 
Function Families
Function FamiliesFunction Families
Function Families
 
Linear programming assignment help
Linear programming assignment helpLinear programming assignment help
Linear programming assignment help
 
2D array
2D array2D array
2D array
 
Programa expresiones regulares
Programa expresiones regularesPrograma expresiones regulares
Programa expresiones regulares
 
Coding Test Review1
Coding Test Review1Coding Test Review1
Coding Test Review1
 
Gm
GmGm
Gm
 
Line drawing algorithm
Line drawing algorithmLine drawing algorithm
Line drawing algorithm
 
Linear regression
Linear regression Linear regression
Linear regression
 
Snowboards r us
Snowboards r usSnowboards r us
Snowboards r us
 

Viewers also liked

Kekuatan dan kelemahan
Kekuatan dan kelemahanKekuatan dan kelemahan
Kekuatan dan kelemahansukmaidi
 
Tesis ajuan
Tesis ajuanTesis ajuan
Tesis ajuansukmaidi
 
Belum terlambat, tetap semangat
Belum terlambat, tetap semangatBelum terlambat, tetap semangat
Belum terlambat, tetap semangathenry jaya teddy
 
Aplikasi program komputer grafik
Aplikasi program komputer grafikAplikasi program komputer grafik
Aplikasi program komputer grafikfahlevizha
 
Real brokerage services encyclopedia.pptx3
Real brokerage services encyclopedia.pptx3Real brokerage services encyclopedia.pptx3
Real brokerage services encyclopedia.pptx3reddvise
 
Makalah komgraf
Makalah komgrafMakalah komgraf
Makalah komgraffahlevizha
 
Pencapaian akreditasi dan modulnya
Pencapaian akreditasi dan modulnyaPencapaian akreditasi dan modulnya
Pencapaian akreditasi dan modulnyaJumpa Utama Amrannur
 
kata-kata penyemangat hidup
kata-kata penyemangat hidupkata-kata penyemangat hidup
kata-kata penyemangat hidupHumanis Group
 
Strategi Melobi & Closing
Strategi Melobi & ClosingStrategi Melobi & Closing
Strategi Melobi & Closing4unsur
 
Standar mutu rs akreditasi kars 2012
Standar mutu rs akreditasi kars 2012Standar mutu rs akreditasi kars 2012
Standar mutu rs akreditasi kars 2012Jumpa Utama Amrannur
 
Point point akreditasi rumah sakit 2012
Point point akreditasi rumah sakit 2012Point point akreditasi rumah sakit 2012
Point point akreditasi rumah sakit 2012Jumpa Utama Amrannur
 
Standar akreditasi rumah sakit APK AP PP PAB
Standar akreditasi rumah sakit APK AP PP PABStandar akreditasi rumah sakit APK AP PP PAB
Standar akreditasi rumah sakit APK AP PP PABJumpa Utama Amrannur
 

Viewers also liked (20)

Grafik garis
Grafik garisGrafik garis
Grafik garis
 
Kekuatan dan kelemahan
Kekuatan dan kelemahanKekuatan dan kelemahan
Kekuatan dan kelemahan
 
Modifikasi grafik column
Modifikasi grafik columnModifikasi grafik column
Modifikasi grafik column
 
Tesis ajuan
Tesis ajuanTesis ajuan
Tesis ajuan
 
Myoval
MyovalMyoval
Myoval
 
Belum terlambat, tetap semangat
Belum terlambat, tetap semangatBelum terlambat, tetap semangat
Belum terlambat, tetap semangat
 
Myline
MylineMyline
Myline
 
Aplikasi program komputer grafik
Aplikasi program komputer grafikAplikasi program komputer grafik
Aplikasi program komputer grafik
 
Modifikasi grafik line
Modifikasi grafik lineModifikasi grafik line
Modifikasi grafik line
 
Real brokerage services encyclopedia.pptx3
Real brokerage services encyclopedia.pptx3Real brokerage services encyclopedia.pptx3
Real brokerage services encyclopedia.pptx3
 
Makalah komgraf
Makalah komgrafMakalah komgraf
Makalah komgraf
 
Pencapaian akreditasi dan modulnya
Pencapaian akreditasi dan modulnyaPencapaian akreditasi dan modulnya
Pencapaian akreditasi dan modulnya
 
Performa puncak
Performa puncakPerforma puncak
Performa puncak
 
kata-kata penyemangat hidup
kata-kata penyemangat hidupkata-kata penyemangat hidup
kata-kata penyemangat hidup
 
Strategi Melobi & Closing
Strategi Melobi & ClosingStrategi Melobi & Closing
Strategi Melobi & Closing
 
Negosiasi
NegosiasiNegosiasi
Negosiasi
 
Bab pelayanan pasien
Bab pelayanan pasienBab pelayanan pasien
Bab pelayanan pasien
 
Standar mutu rs akreditasi kars 2012
Standar mutu rs akreditasi kars 2012Standar mutu rs akreditasi kars 2012
Standar mutu rs akreditasi kars 2012
 
Point point akreditasi rumah sakit 2012
Point point akreditasi rumah sakit 2012Point point akreditasi rumah sakit 2012
Point point akreditasi rumah sakit 2012
 
Standar akreditasi rumah sakit APK AP PP PAB
Standar akreditasi rumah sakit APK AP PP PABStandar akreditasi rumah sakit APK AP PP PAB
Standar akreditasi rumah sakit APK AP PP PAB
 

Similar to Basis graphics

Introduction to Generative Art with Processing
Introduction to Generative Art with ProcessingIntroduction to Generative Art with Processing
Introduction to Generative Art with Processingstefk00
 
COMPUTER GRAPHICS LAB MANUAL
COMPUTER GRAPHICS LAB MANUALCOMPUTER GRAPHICS LAB MANUAL
COMPUTER GRAPHICS LAB MANUALVivek Kumar Sinha
 
Java Fx Overview Tech Tour
Java Fx Overview Tech TourJava Fx Overview Tech Tour
Java Fx Overview Tech TourCarol McDonald
 
Processing and Processing.js
Processing and Processing.jsProcessing and Processing.js
Processing and Processing.jsjeresig
 
C programming (Part 1)
C programming (Part 1)C programming (Part 1)
C programming (Part 1)dezyneecole
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manualUma mohan
 
The Java Fx Platform – A Java Developer’S Guide
The Java Fx Platform – A Java Developer’S GuideThe Java Fx Platform – A Java Developer’S Guide
The Java Fx Platform – A Java Developer’S GuideStephen Chin
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans incnayakq
 
Google I/O 2013 - Android Graphics Performance
Google I/O 2013 - Android Graphics PerformanceGoogle I/O 2013 - Android Graphics Performance
Google I/O 2013 - Android Graphics PerformanceDouO
 
Google I/O 2013 - Android Graphics Performance
Google I/O 2013 - Android Graphics PerformanceGoogle I/O 2013 - Android Graphics Performance
Google I/O 2013 - Android Graphics PerformanceDouO
 

Similar to Basis graphics (20)

Program uts
Program utsProgram uts
Program uts
 
Uts
UtsUts
Uts
 
java graphics
java graphicsjava graphics
java graphics
 
Warna rgb
Warna rgbWarna rgb
Warna rgb
 
Introduction to Generative Art with Processing
Introduction to Generative Art with ProcessingIntroduction to Generative Art with Processing
Introduction to Generative Art with Processing
 
COMPUTER GRAPHICS LAB MANUAL
COMPUTER GRAPHICS LAB MANUALCOMPUTER GRAPHICS LAB MANUAL
COMPUTER GRAPHICS LAB MANUAL
 
Java Fx Overview Tech Tour
Java Fx Overview Tech TourJava Fx Overview Tech Tour
Java Fx Overview Tech Tour
 
Python 1 liners
Python 1 linersPython 1 liners
Python 1 liners
 
Applet life cycle
Applet life cycleApplet life cycle
Applet life cycle
 
Processing and Processing.js
Processing and Processing.jsProcessing and Processing.js
Processing and Processing.js
 
C programming (Part 1)
C programming (Part 1)C programming (Part 1)
C programming (Part 1)
 
C programming
C programmingC programming
C programming
 
JavaFX
JavaFXJavaFX
JavaFX
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
Ansi c
Ansi cAnsi c
Ansi c
 
The Java Fx Platform – A Java Developer’S Guide
The Java Fx Platform – A Java Developer’S GuideThe Java Fx Platform – A Java Developer’S Guide
The Java Fx Platform – A Java Developer’S Guide
 
Struct examples
Struct examplesStruct examples
Struct examples
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans inc
 
Google I/O 2013 - Android Graphics Performance
Google I/O 2013 - Android Graphics PerformanceGoogle I/O 2013 - Android Graphics Performance
Google I/O 2013 - Android Graphics Performance
 
Google I/O 2013 - Android Graphics Performance
Google I/O 2013 - Android Graphics PerformanceGoogle I/O 2013 - Android Graphics Performance
Google I/O 2013 - Android Graphics Performance
 

More from fahlevizha (20)

PPT Komgraf
PPT KomgrafPPT Komgraf
PPT Komgraf
 
Warnargb
WarnargbWarnargb
Warnargb
 
Satutitikhilang
SatutitikhilangSatutitikhilang
Satutitikhilang
 
My line2d
My line2dMy line2d
My line2d
 
Font1
Font1Font1
Font1
 
Font
FontFont
Font
 
Tugas no 2
Tugas no 2Tugas no 2
Tugas no 2
 
Tugas no 1 b
Tugas no 1 bTugas no 1 b
Tugas no 1 b
 
Tugas no 1 a
Tugas no 1 aTugas no 1 a
Tugas no 1 a
 
String rect warna
String rect warnaString rect warna
String rect warna
 
String dan rect
String dan rectString dan rect
String dan rect
 
Segiempat1
Segiempat1Segiempat1
Segiempat1
 
Segiempat
SegiempatSegiempat
Segiempat
 
Rumah
RumahRumah
Rumah
 
Rect
RectRect
Rect
 
Oval , string , line
Oval , string , lineOval , string , line
Oval , string , line
 
My ovalsetengah
My ovalsetengahMy ovalsetengah
My ovalsetengah
 
My ovalacak
My ovalacakMy ovalacak
My ovalacak
 
Myline
MylineMyline
Myline
 
Line
LineLine
Line
 

Recently uploaded

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 

Recently uploaded (20)

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 

Basis graphics

  • 1. Npm : 201243501190 Nama : Reza Fahlevi Kelas : R7H Mata Kuliah : Komputer Grafik Dosen : Nahot Frastian , M.Kom Program Studi : Teknik Informatika Universitas : Universitas Indraprasta Pgri
  • 2. Program Komputer Grafik : - Program BasisGrafik Input : import java.awt.Graphics ; import java.awt.Color ; public class basisgrapik extends java.applet.Applet { public void paint ( Graphics g ) { int xpts [] = {5,25,50,30,15,5}; int ypts [] = { 10, 35 ,20 ,65, 40, 10 } ; g.drawString ( " Java Graphics Basic ",0 , 50 ) ; g.drawLine (5,100,150,250) ; g.setColor ( Color.red ) ; g.drawRect ( 50,100,150,250) ; g.drawRoundRect ( 50 , 150 , 150,250 , 6 , 12 ) ; g.drawPolygon ( xpts , ypts , xpts.length ) ; // Cara Lain Buat Polygon //Polygon poly = new Polygon (xpts + 100 , ypts+100 , xpts.length ) ; // g.fillPolygon ( poly); g.drawOval (150,100,250,55 ) ; g.drawArc ( 50,100,150,275,95,115); } }
  • 3. Proses :  drawString : kordinat x nya : 0 dan kordinat Y nya :50 , sedangkan kata String nya : Java Graphics Basic  drawLine nya : kordinat x1 nya 5 , x2 nya = 150 , y1 = 100 , y2 = 250  Lalu warna yang di gunakan adalah warna merah ( setColor )  drawRect : kordinat x1 nya 50 , x2 nya = 150 , y1 = 100 , y2 = 250  drawRoundRect x1 = 50 ,int y = 150 , int width = 150 , int height = 250 , int xdiam=6 , int ydiam = 12  drawOval : kordinat x1 nya 150 , x2 nya = 250 , y1 = 100 , y2 = 55  drawArc x1 = 50 ,int y = 100 , int width = 150 , int height = 275 , int statangle=95 , int arcangle = 15