-
Bug
-
Resolution: Unresolved
-
P3
-
jfx11, jfx20, 8, jfx17, jfx21
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
Seen on both Windows 10 and RHEL 8
A DESCRIPTION OF THE PROBLEM :
The Node#pressed state is maintained as expected if you press and release the mouse over a node. However if that node is an origin of a drag and drop operation the pressed state remains true.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the sample application. This visualises the pressed state of the circle using red for pressed and black for not pressed.
Start a drag operation from the circle and then release within the stage outside the circle
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Circle to return to black (pressed = false)
ACTUAL -
Circle remains red (pressed = true)
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.DataFormat;
import javafx.scene.input.Dragboard;
import javafx.scene.input.TransferMode;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;
public class StuckPressedState extends Application {
public static void main(String[] args) {
Application.launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
Circle circle = new Circle(100, 100, 20);
circle.setOnDragDetected(event -> {
Dragboard db = circle.startDragAndDrop(TransferMode.ANY);
ClipboardContent clipBoardContent = new ClipboardContent();
clipBoardContent.putString("foo");
db.setContent(clipBoardContent);
});
circle.pressedProperty().addListener((obs, oldValue, newValue) -> {
System.out.println("Pressed " + newValue);
if (Boolean.TRUE.equals(newValue)) {
circle.setFill(Color.RED);
} else {
circle.setFill(Color.BLACK);
}
});
Pane root = new Pane(circle);
root.setOnDragOver(event -> event.acceptTransferModes(TransferMode.ANY));
root.setOnDragDropped(event -> {
System.out.println("Dropped " + event.getDragboard().getContent(DataFormat.PLAIN_TEXT));
event.setDropCompleted(true);
});
root.setPrefSize(200, 200);
primaryStage.setScene(new Scene(root));
primaryStage.show();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No known workaround
FREQUENCY : always
Seen on both Windows 10 and RHEL 8
A DESCRIPTION OF THE PROBLEM :
The Node#pressed state is maintained as expected if you press and release the mouse over a node. However if that node is an origin of a drag and drop operation the pressed state remains true.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the sample application. This visualises the pressed state of the circle using red for pressed and black for not pressed.
Start a drag operation from the circle and then release within the stage outside the circle
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Circle to return to black (pressed = false)
ACTUAL -
Circle remains red (pressed = true)
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.DataFormat;
import javafx.scene.input.Dragboard;
import javafx.scene.input.TransferMode;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;
public class StuckPressedState extends Application {
public static void main(String[] args) {
Application.launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
Circle circle = new Circle(100, 100, 20);
circle.setOnDragDetected(event -> {
Dragboard db = circle.startDragAndDrop(TransferMode.ANY);
ClipboardContent clipBoardContent = new ClipboardContent();
clipBoardContent.putString("foo");
db.setContent(clipBoardContent);
});
circle.pressedProperty().addListener((obs, oldValue, newValue) -> {
System.out.println("Pressed " + newValue);
if (Boolean.TRUE.equals(newValue)) {
circle.setFill(Color.RED);
} else {
circle.setFill(Color.BLACK);
}
});
Pane root = new Pane(circle);
root.setOnDragOver(event -> event.acceptTransferModes(TransferMode.ANY));
root.setOnDragDropped(event -> {
System.out.println("Dropped " + event.getDragboard().getContent(DataFormat.PLAIN_TEXT));
event.setDropCompleted(true);
});
root.setPrefSize(200, 200);
primaryStage.setScene(new Scene(root));
primaryStage.show();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No known workaround
FREQUENCY : always