// This sample demonstrates how to display formatted text in a node // Create a new node ShapeNode node = diagram.getFactory().createShapeNode(10, 10, 60, 20); // Set the node's shape to rectangle node.setShape(Shape.fromId("Rectangle")); // In order to use formatted text, set EnableStyledText to true node.setEnableStyledText(true); // Assign formatted text to the node node.setText("<color=#ff0000>HCl</color> + NaOH = H<sub>2</sub>O + NaCl"); |