miniHessel
miniHessel

Reputation: 846

Custom popup in JavaFX

Is there any way to create a custom PopUp in JavaFX? I can't use tooltip, since I would like it to appear on double click, also I would like a different style than the standard tooltip.

My demands for the popup are: 1. If the user double click, show the popup 2. if the user clicks outside the popup, hide it

Upvotes: 0

Views: 257

Answers (2)

Domenic Portuesi
Domenic Portuesi

Reputation: 23

See this guide on all the different types of popups.

Upvotes: 1

Tomas Mikula
Tomas Mikula

Reputation: 6537

Use Popup.

Popup popup = new Popup();

// add content (you can add as many nodes as you want)
popup.getContent().add(new Label("Hello Popup!"));

// show (move this to the double-click listener)
popup.show(primaryStage);

// hide (move this to the click listener)
popup.hide();

Upvotes: 0

Related Questions