鍍金池/ 教程/ Java/ AWT Graphics2D類(lèi)
AWT BasicStroke類(lèi)
AWT ComponentEvent類(lèi)
AWT Scrollbar類(lèi)
AWT Graphics2D類(lèi)
AWT Canvas類(lèi)
AWT PopupMenu類(lèi)
AWT Ellipse2D類(lèi)
ContainerListener 接口
AWT List類(lèi)
AWT 環(huán)境設(shè)置
AWT Menu類(lèi)
MouseAdapter 類(lèi)
AWT CheckBox類(lèi)
AWT菜單控制
AWT Line2D類(lèi)
MouseMotionListener 接口
AWTGridLayout
AWT TextField類(lèi)
MouseListener 接口
WindowAdapter 類(lèi)
AWT MenuComponent類(lèi)
AWT MenuBar類(lèi)
AWT MouseMotionEvent類(lèi)
AWT 容器(Containers)
ItemListener接口
AWT Event類(lèi)
AWT ActionListener接口
AWT AdjustmentEvent類(lèi)
MouseMotionAdapter 類(lèi)
AWT ActionEvent類(lèi)
AWT ContainerEvent類(lèi)
AWT FlowLayout
AWT 教程首頁(yè)
AWT MenuItem類(lèi)
Panel類(lèi)
AWT Window類(lèi)
AWT 概述介紹
AWT Image類(lèi)
ComponentListener接口
AWT CubicCurve2D類(lèi)
AdjustmentListener 接口
AWT圖形控件
AWT Dialog類(lèi)
KeyListener 接口
AWT Label類(lèi)
LayoutManager 接口
AWT PaintEvent類(lèi)
KeyEvent類(lèi)
AWT TextArea類(lèi)
TextListener 接口
AWT
AWT 適配器(Adapters)
AWT事件處理
Frame類(lèi)
AWT Rectangle2D類(lèi)
AWT FileDialog類(lèi)
AWT Choice類(lèi)
AWT InputEvent類(lèi)
FocusListener 接口
KeyAdapter類(lèi)
TextEvent類(lèi)
AWT 事件監(jiān)聽(tīng)器(Event Listeners)
AWT Container類(lèi)
WindowListener 接口
AWT AWTEvent類(lèi)
AWT控件(Controls)
AWT CardLayout
AWT BorderLayout
AWT 布局(Layouts)
AWT CheckboxMenuItem類(lèi)
AWT Color類(lèi)
AWT WindowEvent類(lèi)
AWT Button類(lèi)
AWT MouseEvent類(lèi)
AWT QuadCurve2D類(lèi)
AWT Font類(lèi)
LayoutManager2 接口
AWT Component類(lèi)
AWT CheckBoxGroup類(lèi)
AWT GridBagLayout
AWT Arc2D類(lèi)

AWT Graphics2D類(lèi)

Graphics2D類(lèi)擴(kuò)展Graphics類(lèi)的幾何坐標(biāo)變換,色彩管理和文本布局提供更復(fù)雜的控制權(quán)。

類(lèi)的聲明

以下是的聲明類(lèi)java.awt.Graphics2D:

public abstract class Graphics2D
   extends Graphics

類(lèi)的構(gòu)造函數(shù)

S.N. 構(gòu)造函數(shù)與說(shuō)明
1 Graphics2D()
Constructs a new Graphics2D object.

類(lèi)方法

S.N. 方法和說(shuō)明
1 abstract void addRenderingHints(Map hints) 
Sets the values of an arbitrary number of preferences for the rendering algorithms.
2 abstract void clip(Shape s) 
Intersects the current Clip with the interior of the specified Shape and sets the Clip to the resulting intersection.
3 abstract void draw(Shape s) 
Strokes the outline of a Shape using the settings of the current Graphics2D context.
4 void draw3DRect(int x, int y, int width, int height, boolean raised) 
Draws a 3-D highlighted outline of the specified rectangle.
5 abstract void drawGlyphVector(GlyphVector g, float x, float y) 
Renders the text of the specified GlyphVector using the Graphics2D context's rendering attributes.
6 abstract void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) 
Renders a BufferedImage that is filtered with a BufferedImageOp.
7 abstract boolean drawImage(Image img, AffineTransform xform, ImageObserver obs) 
Renders an image, applying a transform from image space into user space before drawing.
8 abstract void drawRenderableImage(RenderableImage img, AffineTransform xform) 
Renders a RenderableImage, applying a transform from image space into user space before drawing.
9 abstract void drawRenderedImage(RenderedImage img, AffineTransform xform) 
Renders a RenderedImage, applying a transform from image space into user space before drawing.
10 abstract void drawString(AttributedCharacterIterator iterator, float x, float y) 
Renders the text of the specified iterator applying its attributes in accordance with the specification of the TextAttribute class.
11 abstract void drawString(AttributedCharacterIterator iterator, int x, int y) 
Renders the text of the specified iterator applying its attributes in accordance with the specification of the TextAttribute class.
12 abstract void drawString(String str, float x, float y) 
Renders the text specified by the specified String, using the current text attribute state in the Graphics2D context.
13 abstract void drawString(String str, int x, int y) 
Renders the text of the specified String, using the current text attribute state in the Graphics2D context.
14 abstract void fill(Shape s) 
Fills the interior of a Shape using the settings of the Graphics2D context.
15 void fill3DRect(int x, int y, int width, int height, boolean raised) 
Paints a 3-D highlighted rectangle filled with the current color.
16 abstract Color getBackground() 
Returns the background color used for clearing a region.
17 abstract Composite getComposite() 
Returns the current Composite in the Graphics2D context.
18 abstract GraphicsConfiguration getDeviceConfiguration() 
Returns the device configuration associated with this Graphics2D.
19 abstract FontRenderContext getFontRenderContext() 
Get the rendering context of the Font within this Graphics2D context.
20 abstract Paint getPaint() 
Returns the current Paint of the Graphics2D context.
21 abstract Object getRenderingHint(RenderingHints.Key hintKey) 
Returns the value of a single preference for the rendering algorithms.
22 abstract RenderingHints getRenderingHints() 
Gets the preferences for the rendering algorithms.
23 abstract Stroke getStroke() 
Returns the current Stroke in the Graphics2D context.
24 abstract AffineTransform getTransform() 
Returns a copy of the current Transform in the Graphics2D context.
25 abstract boolean hit(Rectangle rect, Shape s, boolean onStroke) 
Checks whether or not the specified Shape intersects the specified Rectangle, which is in device space.
26 abstract void rotate(double theta)
Concatenates the current Graphics2D Transform with a rotation transform.
27 abstract void rotate(double theta, double x, double y) 
Concatenates the current Graphics2D Transform with a translated rotation transform.
28 abstract void scale(double sx, double sy) 
Concatenates the current Graphics2D Transform with a scaling transformation Subsequent rendering is resized according to the specified scaling factors relative to the previous scaling.
29 abstract void setBackground(Color color) 
Sets the background color for the Graphics2D context.
30 abstract void setComposite(Composite comp) 
Sets the Composite for the Graphics2D context.
31 abstract void setPaint(Paint paint) 
Sets the Paint attribute for the Graphics2D context.
32 abstract void setRenderingHint(RenderingHints.Key hintKey, Object hintValue) 
Sets the value of a single preference for the rendering algorithms.
33 abstract void setRenderingHints(Map hints) 
Replaces the values of all preferences for the rendering algorithms with the specified hints.
34 abstract void setStroke(Stroke s) 
Sets the Stroke for the Graphics2D context.
35 abstract void setTransform(AffineTransform Tx) 
Overwrites the Transform in the Graphics2D context.
36 abstract void shear(double shx, double shy) 
Concatenates the current Graphics2D Transform with a shearing transform.
37 abstract void transform(AffineTransform Tx) 
Composes an AffineTransform object with the Transform in this Graphics2D according to the rule last-specified-first-applied.
38 abstract void translate(double tx, double ty) 
Concatenates the current Graphics2D Transform with a translation transform.
39 abstract void translate(int x, int y) 
Translates the origin of the Graphics2D context to the point (x, y) in the current coordinate system.

繼承的方法

這個(gè)類(lèi)繼承的方法從以下類(lèi):

  • java.lang.Object

Graphics2D 實(shí)例

選擇使用任何編輯器創(chuàng)建以下java程序 D:/ > AWT > com > yiibai > gui >

AWTGraphicsDemo.java

package com.yiibai.gui;

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;

public class AWTGraphicsDemo extends Frame {
       
   public AWTGraphicsDemo(){
      super("Java AWT Examples");
      prepareGUI();
   }

   public static void main(String[] args){
      AWTGraphicsDemo  awtGraphicsDemo = new AWTGraphicsDemo();  
      awtGraphicsDemo.setVisible(true);
   }

   private void prepareGUI(){
      setSize(400,400上一篇:TextListener 接口下一篇:AdjustmentListener 接口