|
Please help me analyze it, why does the following program enter an infinite loop?
mainPanel.addComponentListener (new ComponentAdapter () {
public void componentResized (ComponentEvent e) {
Dimension d = mainPanel.getPreferredSize ();
if (d.width <200) {
mainPanel.setSize (200, d.height);
}
if (d.height <400) {
mainPanel.setSize (d.width, 400);
}
}
}); |
|