here で説明されているように、ガラス板に一連の長方形をペイントしようとしています。問題は、リストの最後の要素だけがペインに表示されていることです。
同じペインに複数の長方形をペイントできる方法はありますか?
使用されているコードは次のとおりです。
JComponent を拡張したペインのクラスの paint メソッド
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);
}
}