Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

floating Tooltip doesn't follow the window #10

Open
safibarri opened this issue May 25, 2020 · 2 comments
Open

floating Tooltip doesn't follow the window #10

safibarri opened this issue May 25, 2020 · 2 comments

Comments

@safibarri
Copy link

safibarri commented May 25, 2020

When a tooltip appears (in case of error) and the main window is moved
the tooltip doesn't follow the window

@safibarri
Copy link
Author

safibarri commented Jun 22, 2020

Issue was reported in JavaBugDatabase (https://bugreport.java.com/)
with Report-ID:9065562.

https://bugs.openjdk.java.net/browse/JDK-8248140

@hohwille
Copy link
Member

Code to reproduce is here:

import javafx.application.Application;
import javafx.geometry.Bounds;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class JDK8248140 extends Application {

  @Override
  public void start(Stage primaryStage) throws Exception {

    VBox root = new VBox();
    Label label = new Label("Label");
    root.getChildren().add(label);
    TextField textField = new TextField();
    root.getChildren().add(textField);
    Label space = new Label();
    root.getChildren().add(space);
    Button button = new Button("Validate");
    button.setOnMouseClicked(e -> {
      Bounds bounds = textField.localToScreen(textField.getBoundsInLocal());
      FxValidationFailureBox failureBox = new FxValidationFailureBox();
      failureBox.setText("Please enter valid data.");
      failureBox.show(textField, bounds.getCenterX(), bounds.getMaxY() - 5);
    });
    root.getChildren().add(button);
    Scene scene = new Scene(root);
    primaryStage.setScene(scene);
    primaryStage.show();
  }

  public static void main(String[] args) {

    Application.launch(JDK8248140.class, args);
  }

  public static class FxValidationFailureBox extends Tooltip {

    public FxValidationFailureBox() {

      super();
      setAutoFix(true);
      getStyleClass().add("ui-validation-failure");
      setAnchorLocation(AnchorLocation.WINDOW_TOP_RIGHT);
    }
  }
}

However, instead of collaborating and following open-source principles Oracle closes the issues and prevents easy feedback. Fingers crossed that they will receive the code and reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants