Home
Categories
Dictionary
Download
Project Details
Changes Log
FAQ
License

Node label position



This article presents how to customize the label position on a node.

Overview

To customize the position of the label on the node, you must access the label through the NodeLabel. This class allows to customize the position of the label for the node. For example:
      NodeLabel label = node.setLabel("The Label");
or:
      NodeLabel label = new NodeLabel("The Label");
      node.setLabel(label);

Customizing the position

It is possible to customize the position of the label though the LabelPlacement.

To specify the placement, you can do:
      LabelPlacement placement = label.createLabelPlacement();
or:
      LabelPlacement placement = label.createLabelPlacement(placement);
The available placement model is: You can specify the position of the label on the different positions inside the node with the LabelPlacement.setPlacement(short) method. The possible placements are:

For example:
      LabelPlacement placement = placement.setPlacement(LabelPlacement.PLACEMENT_CENTER); // put the label on the center of the node
      placement = placement.setPlacement(LabelPlacement.PLACEMENT_TOP_RIGHT); // put the label on the top right of the node

Setting the text position

The horizontal and vertical text position of the label can be specified through the following methods: The possible horizontal text positions are: The possible vertical text positions are:

See also


Categories: general | nodes

Copyright 2021 Herve Girod. All Rights Reserved. Documentation and source under the BSD 3-Clause licence