-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
1.4.2
-
x86
-
windows_xp
Name: jl125535 Date: 09/17/2003
FULL PRODUCT VERSION :
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
It is possible to drop text into a textfield which is not
visible because it is completely hidden by an other
internal frame.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.Run the code below
2.Select "text2" with the mouse.
3.Drag the selection onto the titlebar of "InternalFrame 2"
4. Drop it there.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected: drop is not possible at this location because the
drop target is not visible and is not the top-most
component at this location.
Actual: drop succeeds. The "text2" is dropped into the
completely hidden textfield of internal frame 1.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JTextField;
import java.beans.PropertyVetoException;
public class DropTargetDemo
{
private static final JFrame frame = new JFrame();
private static final JDesktopPane desktopPane = new JDesktopPane();
public static void main(String args[])
{
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(desktopPane);
frame.setSize(300, 300);
frame.show();
addInternalFrame("InternalFrame 1", "", 10, 10);
addInternalFrame("InternalFrame 2", "text2", 10, 30);
}
private static void addInternalFrame(String title, String text, int x,
int y)
{
final JTextField textField = new JTextField(text, 20);
textField.setDragEnabled(true);
JInternalFrame internalFrame = new JInternalFrame(title);
internalFrame.getContentPane().add(textField);
internalFrame.pack();
internalFrame.setLocation(x, y);
internalFrame.setVisible(true);
desktopPane.add(internalFrame);
internalFrame.moveToFront();
try {
internalFrame.setSelected(true);
}
catch (PropertyVetoException e) {
e.printStackTrace();
}
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
Set empty TransferHandlers for the internal frames. After
that it works as expected.
It seems that only the top most Component which is a drop
target receives drop events. This is true even if this top
most drop target rejects the drop. Drop Targets below do
not get the chance to accept a drop.
(Incident Review ID: 178393)
======================================================================
FULL PRODUCT VERSION :
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
It is possible to drop text into a textfield which is not
visible because it is completely hidden by an other
internal frame.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.Run the code below
2.Select "text2" with the mouse.
3.Drag the selection onto the titlebar of "InternalFrame 2"
4. Drop it there.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected: drop is not possible at this location because the
drop target is not visible and is not the top-most
component at this location.
Actual: drop succeeds. The "text2" is dropped into the
completely hidden textfield of internal frame 1.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JTextField;
import java.beans.PropertyVetoException;
public class DropTargetDemo
{
private static final JFrame frame = new JFrame();
private static final JDesktopPane desktopPane = new JDesktopPane();
public static void main(String args[])
{
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(desktopPane);
frame.setSize(300, 300);
frame.show();
addInternalFrame("InternalFrame 1", "", 10, 10);
addInternalFrame("InternalFrame 2", "text2", 10, 30);
}
private static void addInternalFrame(String title, String text, int x,
int y)
{
final JTextField textField = new JTextField(text, 20);
textField.setDragEnabled(true);
JInternalFrame internalFrame = new JInternalFrame(title);
internalFrame.getContentPane().add(textField);
internalFrame.pack();
internalFrame.setLocation(x, y);
internalFrame.setVisible(true);
desktopPane.add(internalFrame);
internalFrame.moveToFront();
try {
internalFrame.setSelected(true);
}
catch (PropertyVetoException e) {
e.printStackTrace();
}
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
Set empty TransferHandlers for the internal frames. After
that it works as expected.
It seems that only the top most Component which is a drop
target receives drop events. This is true even if this top
most drop target rejects the drop. Drop Targets below do
not get the chance to accept a drop.
(Incident Review ID: 178393)
======================================================================
- relates to
-
JDK-4426794 Should be able to drop colors on a JColorChooser
-
- Closed
-
-
JDK-4435403 Support using GlassPane as DropTarget
-
- Resolved
-