| Other |
|---|
| 5.0 b28Fixed |
|
Duplicate :
|
|
|
Relates :
|
|
|
Relates :
|
|
|
Relates :
|
Run the following test case and notice that when the app is brought up
the panel is painted twice.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.plaf.basic.*;
public class Test {
public static void main(String[] args) throws Throwable {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
show();
}
});
}
private static void show() {
JFrame frame = new JFrame("TEST");
JComponent button = new JPanel() {
public void paint(Graphics g) {
super.paint(g);
System.out.println("----------PAINTING---------------------");
System.out.println("widget bounds: " + getBounds());
System.out.println("clip: " + g.getClip());
}
};
frame.setLayout(new FlowLayout());
frame.add(button);
frame.pack();
frame.show();
}
}
|