ASP.NET Pack Programmer's Guide
ShapeListBox Class
Remarks See Also
 






The ShapeListBox control displays a set of shapes defined in the Shape class.

Namespace: com.mindfusion.diagramming
Package: com.mindfusion.diagramming

 Syntax

Java  Copy Code

public class ShapeListBox extends JList<E>

 Remarks

Shapes from the list box can be dragged to the Diagram drawing canvas to create new nodes. Changing the shape of an existing node can be implemented by handling the shapeSelected event and assigning the selected shape to a node by calling setShape.

Initially, the ShapeListBox displays all shapes accessible through fromId. You can limit the list to only a subset of the available shapes by calling the setShapeFilter method. It is also possible to load a shape library from a file using the ShapeLibrary class, and display the loaded shapes as shown below:

Java  Copy Code

ShapeLibrary lib = ShapeLibrary.loadFrom("shapeLib.shl");
shapeListBox.setShapes(lib.getShapes());

The control creates an icon image for each shape added. The size of an icon displayed in the list box can be defined by calling the setIconSize method, and setIconMargin specifies the horizontal and vertical margin of the icon.

If the setAllowRename method is called, users can press the F2 key and rename a shape in the list box. When a shape is renamed, the shapeRenamed event is raised. If setAllowRemove is called, list box items can be deleted by pressing the Del key. When a shape is removed, the shapeRemoved event is raised.

 Inheritance Hierarchy

java.lang.Object
    java.awt.Component
        java.awt.Container
            javax.swing.JComponent
                javax.swing.JList(E)
                    com.mindfusion.diagramming.ShapeListBox

 See Also

ShapeListBox Members
com.mindfusion.diagramming Namespace