Search
Palette Class
Remarks See Also
 






A control that displays a palette of diagram items grouped into categories.

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

 Syntax

Java  Copy Code

public class Palette extends JPanel

 Remarks

The Palette control represents a tool palette that displays DiagramItem objects grouped into categories. It features an accordion-style user interface where each category is represented by a collapsible pane containing an ItemListView.

Structure

Palette follows the Model-View-Controller pattern. The control's data is managed by a PaletteModel (by default, a DefaultPaletteModel). The UI consists of an Accordion container that dynamically generates AccordionPane instances for each PaletteCategory defined in the model.

Population

The control can be populated using the following methods:
  • Categories: Call addCategory to define a new category and create its respective accordion pane.
  • Items: Call addItem to add an item to a specific category. If the category does not exist, it will be created automatically.
  • Direct Model Access: You can also manipulate the PaletteCategory objects directly through the model's Categories collection.

Behavior and Appearance

The Palette exposes properties that govern the behavior and look of all its child list views:

Drag-and-Drop

When an item is dragged from a palette category and dropped onto a diagram, the control creates a new instance by calling the source item's clone method. The dimensions of the new item are set to the current NewInstanceSize.

 Inheritance Hierarchy

java.lang.Object
    java.awt.Component
        java.awt.Container
            javax.swing.JComponent
                javax.swing.JPanel
                    com.mindfusion.diagramming.Palette

 See Also