Add Menu To Top of Button in Java FX -


i trying effect of drop down menu arbitrary contents in javafx button. here have far:

// i'm using popup, isn't owned main window button1.setonmouseclicked(e -> {     final stage dialog = new stage();     dialog.setalwaysontop(true);     dialog.initmodality(modality.none);     dialog.initstyle(stagestyle.undecorated);     try {         vbox popup = (vbox) fxmlloader.load(popup.class.getresource("popup.fxml"));         scene scene = new scene(popup, 50, 100);         bounds boundsinscreen = button1.localtoscreen(button1.getboundsinlocal());         dialog.setx(boundsinscreen.getminx());         dialog.sety(boundsinscreen.getminy() - 100); // isn't dynamic, it's bad         dialog.setscene(scene);         dialog.show();     }     catch (exception ex) {         ex.printstacktrace();     } }); 

i hoping there nice way bundle button , associated popup, (which arbitrary form) in way don't have keep track of size of popup.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -