JHTP小结_第十三章_图形及Java2D

除了最后一节有几个方法,如,GeneralPath(), moveTo(), rotate(), closePath()及translate()没有理解外,其他基本都能理解。

不能理解的部分,权当今后的作业了,因为我要继续前行!Keep moving!


Section 13.1Introduction

• Java’s coordinatesystem (p. 556) is a scheme for identifying every point (p. 567) on the screen.

• A coordinate pair (p.556) has an x-coordinate (horizontal) and a y-coordinate(vertical).

• Coordinates are used toindicate where graphics should be displayed on a screen.

• Coordinate units are measuredin pixels (p. 556). A pixel is a display monitor’s smallest unit of resolution.

Section 13.2Graphics Contexts and Graphics Objects

• A Java graphics context(p. 558) enables drawing on the screen.

• Class Graphics (p. 558)contains methods for drawing strings, lines, rectangles and other shapes.

Methods are also includedfor font manipulation and color manipulation.

• A Graphics objectmanages a graphics context and draws pixels on the screen that represent text andother graphical objects, e.g., lines, ellipses, rectangles and other polygons(p. 558).

• Class Graphics is an abstract class. EachJava implementation has a Graphics subclass that provides drawing capabilities. This implementationis hidden from us by class Graphics, which supplies theinterface that enables us to use graphics in a platform-independent manner.

• Method paintComponentcan be used to draw graphics in any JComponentcomponent.

• Method paintComponentreceives a Graphics object that is passed to the method by the system when alightweight Swing component needs to be repainted.

• When an applicationexecutes, the application container calls method paintComponent. For paintComponentto be called again, an event must occur.

• When a JComponentis displayed, its paintComponent method iscalled.

• Calling method repaint (p. 559) on acomponent updates the graphics drawn on that component.

Section 13.3 ColorControl

• Class Color (p. 559)declares methods and constants for manipulating colors in a Java program.

• Every color is createdfrom a red, a green and a blue component. Together these components are calledRGB values (p. 560). The RGB components specify the amount of red, green andblue in a color, respectively. The larger the value, the greater the amount ofthat particular color.

Color methods getRed, getGreen and getBlue (p. 560)return int values from 0 to 255 representing the amount of red, green andblue, respectively.

Graphics method getColor (p. 560)returns a Color object with the current drawing color.

Graphics method setColor (p. 560) setsthe current drawing color.

Graphics method fillRect (p. 560)draws a rectangle filled by the Graphics object’s current color.

Graphics method drawString(p. 562) draws a String in the current color.

• The JColorChooserGUI component (p. 563) enables application users to selectcolors.

JColorChooserstatic method showDialog (p. 564) displays a modal JColorChooser dialog.

Section 13.4Manipulating Fonts

• Class Font (p. 566)contains methods and constants for manipulating fonts.

• Class Font’sconstructor takes three arguments—the font name (p. 567), font styleand font size.

• A Font’s font stylecan be Font.PLAIN, Font.ITALIC or Font.BOLD (each is a static field of class Font). Font styles can beused in combination (e.g., Font.ITALIC + Font.BOLD).

• The font size ismeasured in points. A point is 1/72 of an inch.

Graphics method setFont (p. 567) setsthe drawing font in which text will be displayed.

Font method getSize (p. 567)returns the font size in points.

Font method getName (p. 567)returns the current font name as a string.

Font method getStyle (p. 569)returns an integer value representing the current Font’s style.

Font method getFamily (p. 569)returns the name of the font family to which the current font belongs. The nameof the font family is platform specific.

• Class FontMetrics(p. 569) contains methods for obtaining font information.

• Font metrics (p. 569)include height, descent and leading.

Section 13.5Drawing Lines, Rectangles and Ovals

Graphics methods fillRoundRect(p. 573) and drawRoundRect (p. 573) drawrectangles with rounded corners.

Graphics methods draw3DRect(p. 575) and fill3DRect (p. 575) drawthree-dimensional rectangles.

Graphics methods drawOval (p. 575) and fillOval (p. 575) drawovals.

Section 13.6Drawing Arcs

• An arc (p. 575) isdrawn as a portion of an oval.

• Arcs sweep from astarting angle by the number of degrees specified by their arc angle (p. 575).

Graphics methods drawArc (p. 575) and fillArc (p. 575) areused for drawing arcs.

Section 13.7Drawing Polygons and Polylines

• Class Polygon containsmethods for creating polygons

• Polygons are closedmultisided shapes composed of straight-line segments.

• Polylines (p. 578) aresequences of connected points.

Graphics method drawPolyline(p. 580) displays a series of connected lines.

Graphics methods drawPolygon(p. 580) and fillPolygon (p. 581) are used to drawpolygons.

Polygon method addPoint (p. 581) addspairs of x- and y-coordinates to the Polygon.

Section 13.8 Java2D API

• The Java 2D API (p.581) provides advanced two-dimensional graphics capabilities.

• Class Graphics2D(p. 581)—a subclass of Graphics—is used fordrawing with the Java 2D API.

• The Java 2D API’sclasses for drawing shapes include Line2D.Double, Rectangle2D.Double, RoundRectangle2D.Double, Arc2D.Doubleand Ellipse2D.Double (p. 581).

• Class GradientPaint(p. 584) helps draw a shape in gradually changing colors—calleda gradient(p. 584).

Graphics2Dmethod fill (p. 584) draws a filled object of any type that implementsinterface Shape (p. 584).

• Class BasicStroke(p. 584) helps specify the drawing characteristics of lines.

Graphics2Dmethod draw (p. 584) is used to draw a Shape object.

• Classes GradientPaint(p. 584) and TexturePaint (p. 585) help specify thecharacteristics for filling shapes with colors or patterns.

• A general path (p. 586)is a shape constructed from straight lines and complex curves and isrepresented with an object of class GeneralPath (p. 586).

GeneralPathmethod moveTo (p. 587) specifies the first point in a general path.

GeneralPathmethod lineTo (p. 588) draws a line to the next point in the path. Each newcall to lineTo draws a line from the previous point to the current point.

GeneralPathmethod closePath (p. 588) draws a line from the last point to the point specifiedin the last call to moveTo. This completes the general path.

Graphics2Dmethod translate (p. 588) is used to move the drawing origin to a new location.

Graphics2D method rotate (p. 588) is used to rotate the next displayed shape.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
毕业设计,基于SpringBoot+Vue+MySQL开发的纺织品企业财务管理系统,源码+数据库+毕业论文+视频演示 在如今社会上,关于信息上面的处理,没有任何一个企业或者个人会忽视,如何让信息急速传递,并且归档储存查询,采用之前的纸张记录模式已经不符合当前使用要求了。所以,对纺织品企业财务信息管理的提升,也为了对纺织品企业财务信息进行更好的维护,纺织品企业财务管理系统的出现就变得水到渠成不可缺少。通过对纺织品企业财务管理系统的开发,不仅仅可以学以致用,让学到的知识变成成果出现,也强化了知识记忆,扩大了知识储备,是提升自我的一种很好的方法。通过具体的开发,对整个软件开发的过程熟练掌握,不论是前期的设计,还是后续的编码测试,都有了很深刻的认知。 纺织品企业财务管理系统通过MySQL数据库与Spring Boot框架进行开发,纺织品企业财务管理系统能够实现对财务人员,员工,收费信息,支出信息,薪资信息,留言信息,报销信息等信息的管理。 通过纺织品企业财务管理系统对相关信息的处理,让信息处理变的更加的系统,更加的规范,这是一个必然的结果。已经处理好的信息,不管是用来查找,还是分析,在效率上都会成倍的提高,让计算机变得更加符合生产需要,变成人们不可缺少的一种信息处理工具,实现了绿色办公,节省社会资源,为环境保护也做了力所能及的贡献。 关键字:纺织品企业财务管理系统,薪资信息,报销信息;SpringBoot
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值