上(ポップアップ)が、私はJavaFXの2のコンテキストメニューに問題がある:私はJFXPanelたContextMenu常に
のグラフ上で左クリックしたときに、それはdisappers決して誰もがこの問題を解決する方法を知っていますか?
おかげ
は、ここに私のコード
final ContextMenu cm = new ContextMenu();
MenuItem chartItem1 = new MenuItem("Chart Settings");
cm.getItems().add(chartItem1);
getScene().setOnMouseReleased(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
if(cm.isShowing()){
cm.hide();
}
if(mouseEvent.getButton() == MouseButton.SECONDARY)
{
cm.show(getScene().getRoot(), mouseEvent.getScreenX(), mouseEvent.getScreenY());
}
}
});
chartItem1.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
dialogs.ChartFormat cs = new dialogs.ChartFormat(null, true);
cs.setLocationRelativeTo(null);
cs.setVisible(true);
}
});
あなたの質問にいくつかのコードを投稿してください。私は[this javadoc](http://docs.oracle.com/javafx/2.0/api/javafx/embed/swing/JFXPanel.html)のコードを使ってデモ・アプリケーションを作成し、シーンに 'ContextMenu'コントロールを追加しました。 JavaFX 2.0.1で私のために働いています。 –