Code to reproduce the issue:
package cz.zcu.fav.kiv.sparkle.gui.tools;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Popup;
import javafx.stage.Stage;
public class Test6 extends Application
{
public static void main(final String[] args)
{
launch(args);
}
@Override
public void start(final Stage primaryStage) throws Exception
{
final Popup popup = new Popup();
final Button button = new Button("Click me");
button.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(final ActionEvent event)
{
popup.show(primaryStage);
}
});
final Button closeButton = new Button("Close");
closeButton.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(final ActionEvent event)
{
popup.hide();
}
});
popup.getContent().add(closeButton);
primaryStage.setScene(new Scene(button));
primaryStage.show();
}
}
1. Click the "Click me" button. Another button appears.
2. Click the "Close" button. It disappears.
3. Repeat the previous two steps to see the issue.
The popup window gets positioned as if it was an ordinary window (that means left screen corner with variable offset on each attempt).
package cz.zcu.fav.kiv.sparkle.gui.tools;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Popup;
import javafx.stage.Stage;
public class Test6 extends Application
{
public static void main(final String[] args)
{
launch(args);
}
@Override
public void start(final Stage primaryStage) throws Exception
{
final Popup popup = new Popup();
final Button button = new Button("Click me");
button.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(final ActionEvent event)
{
popup.show(primaryStage);
}
});
final Button closeButton = new Button("Close");
closeButton.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(final ActionEvent event)
{
popup.hide();
}
});
popup.getContent().add(closeButton);
primaryStage.setScene(new Scene(button));
primaryStage.show();
}
}
1. Click the "Click me" button. Another button appears.
2. Click the "Close" button. It disappears.
3. Repeat the previous two steps to see the issue.
The popup window gets positioned as if it was an ordinary window (that means left screen corner with variable offset on each attempt).