-
Bug
-
Resolution: Duplicate
-
P4
-
8
-
jdk 1.8.0 - b62
To reproduce right-click on the scroll bar between the knob and any arrow.
See that the knob moves and context menu appears simultaneously.
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.Label;
import javafx.scene.control.MenuItem;
import javafx.scene.control.ScrollPane;
import javafx.scene.input.ContextMenuEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class BugScrollPaneContextMenu extends Application {
ScrollPane testedControl;
@Override
public void start(Stage stage) {
testedControl = new ScrollPane();
VBox content = new VBox(15d);
for (int i = 0; i < 10; i++) {
content.getChildren().add(new Label("label #" + i));
}
testedControl.setContent(content);
testedControl.setMaxHeight(150d);
final ContextMenu contextMenu = new ContextMenu();
for (int i = 0; i < 3; i++) {
contextMenu.getItems().add(new MenuItem("Menu item - " + i));
}
testedControl.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() {
@Override
public void handle(ContextMenuEvent t) {
contextMenu.show(testedControl, t.getScreenX(), t.getScreenY());
}
});
HBox root = new HBox(20d);
root.getChildren().add(testedControl);
Scene scene = new Scene(root, 300, 250);
stage.setScene(scene);
stage.setTitle(System.getProperty("java.runtime.version") + "; " + System.getProperty("javafx.runtime.version"));
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
See that the knob moves and context menu appears simultaneously.
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.Label;
import javafx.scene.control.MenuItem;
import javafx.scene.control.ScrollPane;
import javafx.scene.input.ContextMenuEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class BugScrollPaneContextMenu extends Application {
ScrollPane testedControl;
@Override
public void start(Stage stage) {
testedControl = new ScrollPane();
VBox content = new VBox(15d);
for (int i = 0; i < 10; i++) {
content.getChildren().add(new Label("label #" + i));
}
testedControl.setContent(content);
testedControl.setMaxHeight(150d);
final ContextMenu contextMenu = new ContextMenu();
for (int i = 0; i < 3; i++) {
contextMenu.getItems().add(new MenuItem("Menu item - " + i));
}
testedControl.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() {
@Override
public void handle(ContextMenuEvent t) {
contextMenu.show(testedControl, t.getScreenX(), t.getScreenY());
}
});
HBox root = new HBox(20d);
root.getChildren().add(testedControl);
Scene scene = new Scene(root, 300, 250);
stage.setScene(scene);
stage.setTitle(System.getProperty("java.runtime.version") + "; " + System.getProperty("javafx.runtime.version"));
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
- duplicates
-
JDK-8116238 [ScrollBar] Right-click moves the knob.
- Resolved
- relates to
-
JDK-8093511 [ScrollPane] Right-click on the scroll bar moves the knob.
- Closed
-
JDK-8095397 [ScrollBar] Right-click moves the knob and opens a context menu.
- Closed