Class TLcdOverlayPane

All Implemented Interfaces:
Styleable, EventTarget

public final class TLcdOverlayPane extends GridPane
A JavaFX Pane implementation which can be used as an overlay panel on a TLspFXView. This pane is the JavaFX counterpart of TLcdOverlayLayout.

You can add nodes to 9 distinct locations. If multiple nodes are added to the same location, the nodes are laid out vertically: new nodes are put below previous nodes.

Call the add(Node, Location) method to arrange nodes. You can pass a TLcdOverlayPane.Location to constrain the object to this specific location.

Added nodes are not direct children of this pane, but you can query nodes for a specific location. The no-argument getChildren() method inherited from the parent class should not be used.

Example

The following snippet adds a Bing Maps logo and copyright icon to the overlay panel of an FX view:
    TLcdBingMapsLogoIcon logoIcon = new TLcdBingMapsLogoIcon(view);
    Node logoNode = new TLcdFXIcon(logoIcon);

    TLspBingMapsCopyrightIcon copyrightIcon = new TLspBingMapsCopyrightIcon(view);
    Node copyrightNode = new TLcdFXIcon(copyrightIcon);

    FXUtil.findOverlayPane(view).ifPresent(overlayPane -> {
      HBox box = new HBox(logoNode, copyrightNode);
      overlayPane.add(box, TLcdOverlayPane.Location.SOUTH_WEST);
    });
Since:
2020.0
See Also:
  • Constructor Details

    • TLcdOverlayPane

      public TLcdOverlayPane()
      Default Constructor for TLcdOverlayPane.
  • Method Details

    • add

      public void add(Node aNode, TLcdOverlayPane.Location aLocation)
      Adds the node to the specified location. Every location aligns the added nodes to the edges if possible otherwise, all the nodes are centered at the specified location. Below image shows the alignment for every single location with red spots which are the beginning of the this specific location.

      JavaFX overlay panel alignment

      Note that if multiple nodes are added to the same location, all the nodes are laid out vertically: new nodes are put below the existing nodes.
      Parameters:
      aNode - the node to be added to the overlay pane
      aLocation - the location in which the node will be added
    • remove

      public void remove(Node aNode)
      Removes the given node from the corresponding location in the overlay.
      Parameters:
      aNode - the node to remove
    • getChildren

      public List<Node> getChildren(TLcdOverlayPane.Location aLocation)
      Returns the nodes that have been added to the given location, in the order in which they were added. It is recommended to use the add(Node, Location) method to add child nodes in a given location.
      Parameters:
      aLocation - the overlay location to query child nodes for
      Returns:
      the list of nodes. Can be empty, but never null.
    • getChildren

      public ObservableList<Node> getChildren()
      Returns an unmodifiable list containing this pane's direct children. The contents of this list are unspecified and subject to change. The nodes added using the add(Node, Location) method can be retrieved using getChildren(Location).
      Overrides:
      getChildren in class Pane