-
Bug
-
Resolution: Unresolved
-
P4
-
5.0, 5.0u4, 7
-
generic, x86
-
linux, solaris_2.5.1
OPERATING SYSTEM(S):
Redhat Enterprise Linux AS version 4(RHEL4), and
RHEL3, SLES9 SP1.
FULL JDK VERSION(S):
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode)
DESCRIPTION:
Steps to Recreate:
1. Compile the following code.
> javac DragButtonTest.java
============= DragButtonTest.java ======================
import java.awt.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.dnd.*;
import java.awt.event.*;
import java.io.*;
public class DragButtonTest extends Frame implements Transferable, DragGestureListener{
private Button button;
private Label label;
private String str = "test";
private DataFlavor [] flavors = {DataFlavor.plainTextFlavor};
public static void main(String[] args) {
DragButtonTest test = new DragButtonTest();
test.setTitle("Drag Source");
test.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
test.setSize(300,200);
test.setVisible(true);
}
public DragButtonTest(){
button = new Button(str);
label = new Label("Drag the button");
GridLayout g = new GridLayout(2, 1);
g.setHgap(10);
setLayout(g);
add(button);
add(label);
DragSource ds = DragSource.getDefaultDragSource();
ds.createDefaultDragGestureRecognizer(
button,
DnDConstants.ACTION_COPY_OR_MOVE,
this);
}
public DataFlavor[] getTransferDataFlavors() {
return flavors;
}
public boolean isDataFlavorSupported(DataFlavor flavor) {
return (flavor.equals(flavors[0]));
}
public Object getTransferData(DataFlavor flavor)
throws UnsupportedFlavorException, IOException {
if (flavor.equals(flavors[0])){
byte buf[] = str.getBytes("UnicodeLittle");
return new ByteArrayInputStream(buf);
}else{
throw new UnsupportedFlavorException(flavor);
}
}
public void dragGestureRecognized(DragGestureEvent dge) {
dge.startDrag(null, this, null);
label.setText("You've dragged the button.");
}
}
========================================================
2. Run DragButtonTest
> java DragButtonTest
Then "Drag Source" window with a button comes up.
3. Drag the button at "Drag Source" window.
Then the button's background changes to gray, which indicates the button is pressed.
4. Drop the button onto native applications like a terminal.
However the button of Drag Source window remains gray even the drop is finished (mouse button is released). <--- PROBLEM!!
Result
Drag Source button remains pressed state even after dnd operation is finished.
Expected Result
Drag source button should become normal state after dnd operation is finished.
Additional Information:
1) This problem occurs on both XAWT and Motif AWT.
2) This problem doesn't occur with Java 1.4.2 (1.4.2_07-b05)
###@###.### 2005-07-08 15:57:38 GMT
Redhat Enterprise Linux AS version 4(RHEL4), and
RHEL3, SLES9 SP1.
FULL JDK VERSION(S):
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode)
DESCRIPTION:
Steps to Recreate:
1. Compile the following code.
> javac DragButtonTest.java
============= DragButtonTest.java ======================
import java.awt.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.dnd.*;
import java.awt.event.*;
import java.io.*;
public class DragButtonTest extends Frame implements Transferable, DragGestureListener{
private Button button;
private Label label;
private String str = "test";
private DataFlavor [] flavors = {DataFlavor.plainTextFlavor};
public static void main(String[] args) {
DragButtonTest test = new DragButtonTest();
test.setTitle("Drag Source");
test.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
test.setSize(300,200);
test.setVisible(true);
}
public DragButtonTest(){
button = new Button(str);
label = new Label("Drag the button");
GridLayout g = new GridLayout(2, 1);
g.setHgap(10);
setLayout(g);
add(button);
add(label);
DragSource ds = DragSource.getDefaultDragSource();
ds.createDefaultDragGestureRecognizer(
button,
DnDConstants.ACTION_COPY_OR_MOVE,
this);
}
public DataFlavor[] getTransferDataFlavors() {
return flavors;
}
public boolean isDataFlavorSupported(DataFlavor flavor) {
return (flavor.equals(flavors[0]));
}
public Object getTransferData(DataFlavor flavor)
throws UnsupportedFlavorException, IOException {
if (flavor.equals(flavors[0])){
byte buf[] = str.getBytes("UnicodeLittle");
return new ByteArrayInputStream(buf);
}else{
throw new UnsupportedFlavorException(flavor);
}
}
public void dragGestureRecognized(DragGestureEvent dge) {
dge.startDrag(null, this, null);
label.setText("You've dragged the button.");
}
}
========================================================
2. Run DragButtonTest
> java DragButtonTest
Then "Drag Source" window with a button comes up.
3. Drag the button at "Drag Source" window.
Then the button's background changes to gray, which indicates the button is pressed.
4. Drop the button onto native applications like a terminal.
However the button of Drag Source window remains gray even the drop is finished (mouse button is released). <--- PROBLEM!!
Result
Drag Source button remains pressed state even after dnd operation is finished.
Expected Result
Drag source button should become normal state after dnd operation is finished.
Additional Information:
1) This problem occurs on both XAWT and Motif AWT.
2) This problem doesn't occur with Java 1.4.2 (1.4.2_07-b05)
###@###.### 2005-07-08 15:57:38 GMT
- duplicates
-
JDK-7082874 Problems with Button's colour when using DnD operations
-
- Closed
-
- relates to
-
JDK-6329253 Regression testcase java/awt/dnd/DnDClipboardDeadlockTest fails
-
- Closed
-
-
JDK-4215643 Dnd of a button on Solaris platform causes button be always pressed.
-
- Closed
-