-
Bug
-
Resolution: Fixed
-
P3
-
1.3.0
-
beta2
-
generic
-
generic
Name: krT82822 Date: 09/29/99
As you know, "faster" dragging mode for JInternalFrame using copyArea() has been added from Swing 1.1.1(JDK 1.2.2), and in JDK 1.3 beta it is now default.
It work fine in most cases, but fails to work when a JComboBox is in JInternalFrame. When a JComboBox is contained in a JInternalFrame, the dragging will be revert to the slow dragging.
This is partly because of optimized dragging defence code added to JInternalFrame and DefaultDesktopManager. Again as you know, the purpose of the defence code is to prevent race condition from occuring when full content of JInternalFrame is not yet available and dragging is undergoing simultaneously (can those cases ever be happened when the dragging is not done programatically in a separate thread?). Thus the defence codes prevent use of copyArea() when DefaultDesktopManager.dragFrameFaster(JComponent f, int x, int y) is called after the actual repainting of JInternalFrame is done.
But JComboBox adds AncestorListener, and causes part of JInternalFrame where it is to be repainted everytime any ancestor(including JInternalFrame) is moved. The result is the activation of faster dragging defence code.
I think the problem should be fixed in JComboBox (BasicComboPopup) in order not to repaint everytime it moves by movement of its ancestor.
Even though reproduction of this problem is fairly easy, I include a test code for your convenience:
<blockquote><pre>
import javax.swing.*;
public class Test {
public static void main(String[] argv) {
JFrame frame = new JFrame("Fast Drag Test");
JDesktopPane dpane = new JDesktopPane();
dpane.putClientProperty("JDesktopPane.dragMode", "faster");
frame.getContentPane().add(dpane);
JInternalFrame a = new JInternalFrame();
JInternalFrame b = new JInternalFrame();
a.getContentPane().add(new JButton("I'm fast!"));
b.getContentPane().add(new JComboBox(new String[] {"Why am I so slow?"}));
a.setBounds(10, 10, 300, 300);
dpane.add(a);
a.setVisible(true);
b.setBounds(300, 300, 300, 300);
dpane.add(b);
b.setVisible(true);
frame.setBounds(0, 0, 800, 800);
frame.setVisible(true);
}
}
</pre></blockquote>
(Review ID: 95939)
======================================================================