getGraphics public Graphics getGraphics()Creates a graphics context for this component. This method will return null if this component is currently not displayable. Returns: a graphics context for this component, or null if it has none Since: JDK1.0 See Also: paint(java.awt.Graphics)只要将frame.getContentPane().add(panel);这句放在前面就可以通过编译了,但是很少人会像你那样写画图程序.....
但是为什么取不到呢?用panel.getGraphics()不是其中一种取得绘图对象的方法吗?
请说详细点,谢谢~
public Graphics getGraphics()Creates a graphics context for this component. This method will return null if this component is currently not displayable. Returns:
a graphics context for this component, or null if it has none
Since:
JDK1.0
See Also:
paint(java.awt.Graphics)只要将frame.getContentPane().add(panel);这句放在前面就可以通过编译了,但是很少人会像你那样写画图程序.....