Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Smart Computers Graphics Questions: Write Java code to display a rectangle box and apply the following transformation Scaling. Please note that if any data is

Smart Computers Graphics

image text in transcribed

image text in transcribed

Questions: Write Java code to display a rectangle box and apply the following transformation Scaling. Please note that if any data is required, such as scaling factor, please assume some values and specify them in the program with the comments. 23C Cloudy DUL Enig F4 FS F10 F11 612 Entt $ % & p3 3 E 4 6 B Ri ZUG P import java.applet.Applet; import java.awt.Graphics; public class Draw extends Applet { int Ox1 = 50; int Oy1 = 50; int Ox2 = 250; int Oy2 = 50; int Ox3 = 250; int Oy3 = 150; int Ox4 = 50; int Oy4 = 150; int Tx =100; int Ty=100; int nx1,ny1,nx2,ny2, nx3,ny3,nx4, ny4; public void paint(Graphics e) { g.drawLine(Ox1,0y1,0x2,0y2); g.drawLine(Ox2,0y2,0x3,0y3); g.drawLine(Ox3,Oy3,0x4,0y4); g.drawLine(Ox4,0y4,0x1,0y1); nx1= Ox1+Tx; ny1= Oy1+TY; nx2= Ox2+Tx; ny2= Oy2+Ty; nx3= Ox3+Tx; ny3= Oy3+Ty; nx4=Ox4+Tx; ny4= Oy4+TY; g.drawLine(nx1,nyi,nx2,ny2); g.drawLine(nx2,ny2,nx3,ny3); g.drawLine(nx3,ny3,nx4, ny4); g.drawLine(nx4, ny4,nx1,ny1); } W

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming Languages 12th International Symposium Dbpl 2009 Lyon France August 2009 Proceedings Lncs 5708

Authors: Philippa Gardner ,Floris Geerts

2009th Edition

3642037925, 978-3642037924

More Books

Students also viewed these Databases questions

Question

Question Can a Keogh plan fund be reached by the owners creditors?

Answered: 1 week ago

Question

Question What happens to my plan if I die?

Answered: 1 week ago