<Swing Dev> DnD fails with JTextArea and JTextField
Sean Chou
zhouyx at linux.vnet.ibm.com
Thu Jun 2 09:31:55 UTC 2011
Hi,
I reported, but the system doesn't reply me a bug number. It says "will give
me email",
but I haven't got one yet. Is this the right process, or I might make a
problem when
reporting?
2011/5/27 Pavel Porvatov <pavel.porvatov at oracle.com>
> Hi Sean,
>
> Hi all,
>
> I have a testcase related to DnD failure with JTextArea and
> JTextField on linux. The
> testcase is as follows:
>
> /*
> * DnDTest.java
> */
> import java.awt.Color;
> import java.awt.Component;
> import java.awt.Dimension;
> import java.awt.FlowLayout;
> import java.awt.Frame;
> import java.awt.event.WindowAdapter;
> import java.awt.event.WindowEvent;
>
> import javax.swing.JTextArea;
> import javax.swing.JTextField;
>
>
> public class DnDTest extends Frame {
> Component c;
> public DnDTest() {
> super("Single Frame --- AWT Frame");
> super.setBackground(Color.gray);
> // set layout here.
> setLayout(new FlowLayout());
> c = new JTextArea("JTextArea component");
> c.setPreferredSize(new Dimension(400, 100));
> add(c);
> c = new JTextField("JTextField component(No IM)");
> c.setPreferredSize(new Dimension(400, 20));
> add(c);
> addWindowListener(new WindowAdapter() {
> public void windowClosing(WindowEvent event) {
> System.exit(0);
> }
> });
> setSize(850, 360);
> setVisible(true);
> }
> public static void main(String[] args) {
> new DnDTest();
> }
> }
>
>
> Reproduce steps:
> 1. Run the testcase with b143
> 2. Open a new file with gedit and input some words like "abcde"
> 3. Drag "abcde" into JTextField and drop it there.
> 4. Once more, drag "abcde" into JTextField and then move out of the Frame
> (keep draging) and drag into JTextField again and drop it.
>
> Expectation:
> The second DnD inputs another "abcde" into JTextField.
>
> Result:
> The second DnD inputs nothing into JTextField.
>
> Yes, looks like a bug. The test case works on Windows as expected.
>
>
> Investigation:
> The JTextArea as well has this problem, and in step 4, if we drag "abcde"
> over JTextField and then drop into JTextArea, nothing
> is input into JTextArea either. However, if "abcde" is drag into JTextField
> or JTextArea directly or when JTextArea/Field are
> empty as in step 2, it works.
>
>
> Are there any comments? And can anyone file a bug for it please ?
>
> Anybody can file a bug, http://bugreport.sun.com/bugreport/
>
> Regards, Pavel
>
--
Best Regards,
Sean Chou
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20110602/32aed0dc/attachment.html>
More information about the swing-dev
mailing list