サブクラス化された JPanel を使用して JTable セルをレンダリングしようとしています。セルは、円が描かれた色付きの長方形として表示されます。テーブルが最初に表示されたときはすべて問題ないように見えますが、削除されたときにセルの上にダイアログまたは何かが表示されると、覆われたセルが適切にレンダリングされず、円が分割されます。その後、スクロールバーを移動する必要がありますまたはウィンドウを拡張して、適切に再描画できるようにします。
セルをレンダリングするために使用しているコンポーネントの paintComponent メソッドは次のとおりです。
protected void paintComponent(Graphics g) {
setOpaque(true);
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
GradientPaint gradientPaint = new GradientPaint(new Point2D.Double(0, 0), Color.WHITE, new Point2D.Double(0,
getHeight()), paintRatingColour);
g2d.setPaint(gradientPaint);
g2d.fillRect(0, 0, getWidth(), getHeight());
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
Rectangle clipBounds = g2d.getClipBounds();
int x = new Double(clipBounds.getWidth()).intValue() - 15;
int y = (new Double(clipBounds.getHeight()).intValue() / 2) - 6;
if (level != null) {
g2d.setColor(iconColour);
g2d.drawOval(x, y, width, height);
g2d.fillOval(x, y, width, height);
}
}