-
Bug
-
Resolution: Fixed
-
P2
-
1.2.2
-
beta
-
generic
-
generic
Name: vi73552 Date: 06/30/99
This code demonstrates this problem. The table repaints through the panel that is added to the glass pane. The problem occurs in both JDK 1.1.6/JFC 1.1 and JDK 1.2.1, although it manifests itself somewhat differently.
-------8<----------------------------
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.border.*;
public class RepaintFrame extends JFrame
{
DefaultTableModel model = new DefaultTableModel(10, 10);
public RepaintFrame()
{
this.setLocation(120, 120);
JTable table = new JTable(model);
JScrollPane scroll = new JScrollPane(table);
table.setPreferredScrollableViewportSize(new Dimension(400, 200));
this.getContentPane().add(scroll);
JComponent glass = (JComponent) this.getRootPane().getGlassPane();
final JPanel panel = new JPanel();
panel.setBorder(new EtchedBorder());
glass.add(panel);
glass.setVisible(true);
panel.setPreferredSize(new Dimension(100, 100));
this.pack();
this.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent event)
{
System.exit(0);
}
});
Timer timer = new Timer(200, new ActionListener()
{
Random random = new Random();
public void actionPerformed(ActionEvent event)
{
model.setValueAt(new Integer(random.nextInt() % 100),
Math.abs(random.nextInt() % 10),
Math.abs(random.nextInt() % 10));
}
});
timer.start();
}
public static void main(String[] args)
{
new RepaintFrame().show();
}
}
(Review ID: 85037)
======================================================================