我想在here描述画了一系列的矩形的玻璃面板。问题是只有我列表中的最后一个元素显示在窗格上。怎么可能画上玻璃板不止一个矩形?
有谁怎么能画一个以上的矩形在同一窗格?
下面是所用的代码:在窗格的类
涂料的方法,延伸的JComponent
protected void paintComponent(Graphics g) {
if (point != null) {
int value = this.getGradient();
Color myColour = new Color(255, value, 0, 175);
g.setColor(myColour);
g.fillRect(point.x - 13, point.y - 15, this.width, this.height);
}
}
为了更好地帮助越早,张贴[SSCCE(http://sscce.org/)。 – 2012-03-30 04:22:56
'图形G = container.getGraphics();'也就是说立即怀疑,但我会进一步评论之前等待SSCCE。 – 2012-03-30 04:23:57
+1,对于这个问题,让我学到新的东西:-) – 2012-03-30 05:13:37