from http://java.sun.com/j2se/1.3/docs/api/index.html
getGraphics
public Graphics getGraphics()
Returns this component's graphics context, which lets you draw on a component. Use this method get a Graphics object and then invoke oeprations on that object to draw on the component.
Overrides:
getGraphics in class Component
Following copied from class: java.awt.Component
Returns:
A graphics context for this component, or null if it has none.
See Also:
Component.paint(java.awt.Graphics)
getGraphics
public Graphics getGraphics()
Returns this component's graphics context, which lets you draw on a component. Use this method get a Graphics object and then invoke oeprations on that object to draw on the component.
Overrides:
getGraphics in class Component
Following copied from class: java.awt.Component
Returns:
A graphics context for this component, or null if it has none.
See Also:
Component.paint(java.awt.Graphics)
解决方案 »
- 寻求2个Java面试题的解题思路和答案
- 字符串求值问题
- 文本框只允许数字输入,限制英文输入
- 线程的调用与停止
- 【UML的问题】在通讯图(就是2.0的协作图里)如何对if-else建模?
- 《java编程艺术》上的chapter5上的例子编译不了!求助ing!!!
- 请教equals和==的区别
- 如何使用WebLogic的LDAP服务,最好有相关文档和教材,拜谢
- 求助,在LINUX下不能使用JDK。请帮助,万分感谢!
- 为什么JB中的输入不接受回车,而控制台输入又接受?
- 询问ie中的Applet的NotSuchMethodException异常!
- 如何通用JAVA调用静态链接库或DLL中的API?并能嵌入ASP中使用。内有重奖,各位请点开看!!
是得到当前的Graphics对象句柄,
而如果当前Graphics是不可见的,就会得到null指针.
例如在applet中,如果在init()中使用,就得到null
如果在start()中,就能得到正确的句柄.
这是最近我在写俄罗斯方块是知道的.:)