Search
Modifying the Diagram Appearance

You can customize most of JDiagram visualization effects.

Background

JDiagram background area is filled using the brush specified by the setBackBrush method. Background theme can also be an image set by the setBackgroundImage method. The image can be any of the supported by Java file formats - JPG, PNG or GIF. Background image can be centered, aligned to a corner of the control or document, tiled or stretched to cover the drawing area - as specified by the setBackgroundImageAlign method.

Shadows

By default all diagram objects have shadows drawn under them. If the shadow style is set to OneLevel, the object shadows are drawn at the lowest Z-level under all objects, which makes them look as on single Z-level. If it is set to ZOrder, each shadow is drawn immediately under its corresponding object, possibly covering parts of other objects, which gives more 3D-like look to the diagram. If the style is set to None, no shadows are drawn. The shadows style can be set through the setShadowsStyle method. Shadows' offset from items is specified by the setShadowOffset, setShadowOffsetX and setShadowOffsetY methods. Shadows are painted using the brush specified via setShadowBrush.

Selection

Selection handles drawn around the active item can be customized through the style object returned by getActiveItemHandlesStyle. Items in multiple selection have their handles drawn using the style returned by getSelectedItemHandlesStyle. Disabled manipulation handles are painted using the style returned by getDisabledHandlesStyle when disabled handles are displayed (see setShowDisabledHandles). You can control the way multiple selection is displayed through the setHandlesStyle method of the Selection class.

Mouse Cursors

Different mouse cursor icons can be set to give context-sensitive feedback to users, prompting them if creation/modification of an object is possible. The following methods can be used to specify the cursor's appearance in different situations: setPointerCursor, setMoveCursor, setDisallowCursor, setDrawLinkCursor, setAllowLinkCursor, setDisallowLinkCursorsetHorizontalResizeCursor, setVerticalResizeCursor, setDiagonalResizeCursor, setCounterDiagonalResizeCursor.

Grid Settings

You can turn on/off the alignment grid by calling the setShowGrid method. The setGridColor method can be used to specify the color of grid points and lines.