上一篇 下一篇
介绍Canvas控件代表一个矩形区域,应用程序可以画的东西,或者可以由用户创建的接收输入。
类的声明以下是声明的java.awt.Canvas类:
类的构造函数S.N. 构造函数& 描述
1
Canvas()
Constructs a new Canvas.
2
Canvas(GraphicsConfiguration config)
Constructs a new Canvas given a GraphicsConfiguration object.
S.N. 方法& 描述
1
void addNotify()
Creates the peer of the canvas.
2
void createBufferStrategy(int numBuffers)
Creates a new strategy for multi-buffering on this component.
3
void createBufferStrategy(int numBuffers, BufferCapabilities caps)
Creates a new strategy for multi-buffering on this component with the required buffer capabilities.
4
AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this Canvas.
5
BufferStrategy getBufferStrategy()
Returns the BufferStrategy used by this component.
6
void paint(Graphics g)
Paints this canvas.
7
void pdate(Graphics g)
Updates this canvas.
这个类继承的方法从以下类:
java.awt.Component
java.lang.Object
选择使用任何编辑器创建以下java程序 D:/ > AWT > com > yiibai > gui >
AwtControlDemo.java prepareGUI();} awtControlDemo} mainFrame mainFrame mainFrame mainFrame}}); headerLabel headerLabel statusLabel statusLabel statusLabel controlPanel controlPanel mainFrame mainFrame mainFrame mainFrame} headerLabel controlPanel mainFrame} setBackground setSize} g2 g2编译程序,使用命令提示符。到 D:/ > AWT 然后键入以下命令。
D:AWT>javac comyiibaiguiAwtControlDemo.java如果没有错误出现,这意味着编译成功。使用下面的命令来运行程序。
D:AWT>java com.yiibai.gui.AwtControlDemo验证下面的输出
标签:AWT Canvas 类 介绍 Canvas 控件 代表 一
本站文章除注明转载外,均为本站原创或编译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动共创优秀实例教程
转载请注明:文章转载自:易百教程 [http:/www.yiibai.com]
本文标题:AWT Canvas类
本文地址:
上一篇 下一篇