public void paint(Graphics g) {
super.paint(g);
Color c = g.getColor();
g.setColor(Color.RED);
g.fillOval(x, y, 30, 30);
g.setColor(c);
y += 5;
}这样呢? 44看哇
super.paint(g);
Color c = g.getColor();
g.setColor(Color.RED);
g.fillOval(x, y, 30, 30);
g.setColor(c);
y += 5;
}这样呢? 44看哇
解决方案 »
- 请教一个树形实例的算法
- 帮忙看一下为什么JApplet无法在IE里显示
- java如何调用sql server存储过程?
- throws问题
- 再没办法,我只好疯算了
- java不是一个可视化的开发环境,界面也要用代码写,我的理解对吗?
- 难道没人能帮我吗?高分相送!
- 一道关于Unicode字符转换的简单题(在线等,简单题,一有正确答案,立刻给分!)
- String类和StringBuffer的区别?对"String不能变StringBuffer可以改变"理解不清楚
- A class defined within a method can only access final fields of the enclosing method.怎么理解啊?请举个简单的例子.
- 什么是java bridge方法?
- socket传文件,如何设置合理的缓存?
public void repaint(long tm, int x, int y, int width, int height) {
if (this.peer instanceof LightweightPeer) {
// Needs to be translated to parent coordinates since
// a parent native container provides the actual repaint
// services. Additionally, the request is restricted to
// the bounds of the component.
if (parent != null) {
int px = this.x + ((x < 0) ? 0 : x);
int py = this.y + ((y < 0) ? 0 : y);
int pwidth = (width > this.width) ? this.width : width;
int pheight = (height > this.height) ? this.height : height;
parent.repaint(tm, px, py, pwidth, pheight);
}
} else {
if (isVisible() && (this.peer != null) &&
(width > 0) && (height > 0)) {
PaintEvent e = new PaintEvent(this, PaintEvent.UPDATE,
new Rectangle(x, y, width, height));
Toolkit.getEventQueue().postEvent(e);
}
}
}JFrame和Frame一个为轻量级、一个为重量级,轻量级的未完全重构