CIS 234: Representation and Applets.


83 views
Uploaded on:
Description
CIS 234: Illustrations and Applets Dr. Ralph D. Westfall February, 2002 Illustrations back in the "good old days," PCs just worked with content no pictures no data boxes no mouse Palo Alto Examination Center (PARC) made first GUI in 1970s, Apple replicated it in 1980s, Microsoft duplicated in 1990s
Transcripts
Slide 1

CIS 234: Graphics & Applets Dr. Ralph D. Westfall February, 2002

Slide 2

Graphics back in the "good old days," PCs just worked with content no pictures no information boxes no mouse Palo Alto Research Center (PARC) made first GUI in 1970s, Apple replicated it in 1980s, Microsoft duplicated in 1990s

Slide 3

Advantages of Graphics less demanding to work with snap "icon" instead of sort project name less preparing obliged more amusing to utilize programs with design more enjoyable to compose illustrations programs

Slide 4

Java Graphics & the Internet can utilize Java representation in general Java applications (may be) simpler to begin utilizing representation with Java that keeps running in a web program to keep running in a program, Java should be coded into an Applet that keeps running in a HTML site page.:

Slide 5

What Is HTML? Hyper Text Markup Language hyper implies much more noteworthy hypertext has hotlinks to other material markup dialect tells PC how/where to show material word preparing projects utilize their own particular markup dialects once in the past obvious (show codes), now concealed

Slide 6

HTML Tags markup data is encased in edge sections, for example, <p> [paragraph] sections + content = label control appearance of page or content not noticeable in program can check whether use View>Source every now and again work in sets <b> some content and so forth </b> [bold]

Slide 7

Java Applet a Java class that keeps running in a window in a HTML page in a web program rather than in a DOS window HTML has unique labels for applets likewise has labels for parameters (contentions) that can be utilized as inputs to the applet

Slide 8

Java Graphics Capabilities place content on an Applet draw geometric figures: straight line, bend, rectangle, oval, and so on. add shading to realistic things

Slide 9

Applet Graphics Methods applets utilize an init() strategy as opposed to primary technique at begin could be verifiable (not unmistakable) notwithstanding init() and so on., all Applets have paint system – puts design objects on the Applet repaint strategy – "refreshes" Applet to mirror any progressions (conceivably certain)

Slide 10

Coordinates qualities to recognize position on screen x (first) what number of pixels to right y (2 nd ) what number of pixels down 0, 0 is upper left corner 800, 600 is toward lower right real position relies on upon width/tallness of screen (e.g., is in center of 1600 x 1200 screen)

Slide 11

Using Java with HTML <applet code = "MyApplet.class" width = 250 stature = 200> </applet> shows MyApplet in window in program window = 250 pixels wide, 200 pixels high can change width and tallness most screens are 800 x 600 or bigger

Slide 12

drawString Method puts a String (content) on Applet 3 contentions: string, x, y (directions) can utilize it in a paint strategy open void paint(Graphics g) //g {g.drawString("Hi", 10, 20);} //g Java consequently supplies an illustrations item; can call it g or whatever else

Slide 13

setFont Method pronouncing Font myFont = new Font("Helvetica", Font.ITALIC, 24); Courier , Helvetica and TimesRoman BOLD, ITALIC or PLAIN # of focuses (10 or 12 ordinary in Word doc) utilizing as a part of a paint strategy g.setFont(myFont);

Slide 14

Setting Colors Color class has 13 constants (p. 160) Color.blue, Color.red, Color.darkGrey, and so on. setColor sets closer view shading setBackground sets Applet foundation utilizing as a part of a paint strategy g.setColor(Color.green);/design object this.setBackground(Color. yellow); /this = Applet

Slide 15

Creating a Graphics Object paint system naturally gets a realistic question most different strategies don\'t get a design item need to utilize getGraphics strategy to make representation object inside different techniques Graphics g = getGraphics(); g.drawString("Hello", 5, 50);

Slide 16

drawLine Method contentions are 2 sets of directions x, y for 1 point and x, y for flip side g.drawLine(10, 10, 40, 10);/? g.drawLine(10, 10, 10, 40);/? g.drawLine(10, 10, 40, 40);/?

Slide 17

Rectangle Methods contentions are upper left corner directions (x, y), and width and stature g.drawRect(10, 100, 80, 30);/layout corner = 10, 100; width = 80; height= 30 g.fillRect(100,100,30,80);/strong shading g.clearRect(105, 105, 20, 70);/inside is same shading as foundation

Slide 18

Rounded Rectangles takes 6 contentions: corner directions, rectangle width and tallness, in addition to width and stature of corner ovals with bigger widths and statures, corners get more adjusted g.drawRoundRect(5, 5, 30, 30, 2, 2); g.drawRoundRect(5, 5, 30, 30, 4, 6);

Slide 19

Ovals oval routines draw ovals that would fit in a rectangle of same size g.drawOval(10, 10, 80, 30);/diagram g.fillOval (10, 10, 30, 80);/strong shading g.clearOval(10, 10, 80, 30);/inside is same shading as foundation

Slide 20

.:tslid

Recommended
View more...