FANDOM


This is simple example of a button using javafx.ui.PopupMenu by Christopher Oliver, 22-May-2007, openjfx users ML that works in JFXPad.

Popup

import javafx.ui.*;
import javafx.ui.canvas.*;

Button {
     text: "Click Popup"
     var: self
     var popup = PopupMenu {
         x: 0
         y: bind self.height
         owner: self
         items: foreach (i in [1..3])
         MenuItem {
             text: "Item {i}"
         }
     }
     action: operation() {
         popup.visible = true;
     }
}
Community content is available under CC-BY-SA unless otherwise noted.