Recent Changes - Search:

Information

Installation

Documentation

ElementsSegmentSet2D

A set is just an empty element, that can host other elements (and sets). As such, a set has a position and a size, and accepts a transformation, but you need to add other elements to the set to make it display anything on the panel. The great advantage of sets is that they allow manipulation of collections of other drawables as a whole.

Properties

Number of elements
NameDescriptionValues acceptedDefault
#Elements The number of elements in the set.An integer value. 
Position and Size
NameDescriptionValues acceptedDefault
Pos XThe X coordinate for the elements.A constant or variable of type double, int or double[]. 
Pos YThe Y coordinate for the elements.A constant or variable of type double, int or double[]. 
Position []The double[][] array with the coordinates of the elements.A double matrix. 
Size XThe size of the elements in the X direction.A constant or variable of type double, int or double[]. 
Size YThe size of the elements in the Y direction.A constant or variable of type double, int or double[]. 
Size []The double[][] array with the size of the elements in each direction.A double matrix. 
Scale XThe scale factor for the element in the X direction.A constant or variable of type double or int. 
Scale YThe scale factor for the element in the Y direction.A constant or variable of type double or int. 
TransformThe transformation to apply to this element.Use the editor provided or read more about 2D transformations. 
Visibility and Interaction
NameDescriptionValues acceptedDefault
Menu EntryThe name to display in the simulationĀ“s corresponding elements menu entry.A String constant or variable. 
VisibleThe visibility of the elements.A boolean variable or a boolean array with true or false values. 
MeasuredWhether the element affects its parent panel's autoscaling.A boolean variable or one of the constants true or false. 
DraggableWhether the elements can be moved.A boolean variable or a boolean array with true or false values. 
ResizableWhether the elements can be resized.A boolean variable or a boolean array with true or false values. 
Drag GroupWhether dragging the element affects its group.A boolean variable or a boolean array with true or false values. 
Resize GroupWhether resizing the element affects its group.A boolean variable or a boolean array with true or false values. 
SensitivityThe size of the hot spots (in pixels).A variable or array within integer values, 0 makes the full particle the hot spot. 
Interaction IndexThe index of the element affected by the interaction.An integer value. 
On PressThe action to invoke when the element is pressed.The Java code to invoke for the action. 
On DragThe action to invoke when the element is dragged.The Java code to invoke for the action. 
On ReleaseThe action to invoke when the element is released.The Java code to invoke for the action. 
On EnterThe action to invoke when the mouse enters the element.The Java code to invoke for the action. 
On ExitThe action to invoke when the mouse leaves the element.The Java code to invoke for the action. 
Graphical Aspect
NameDescriptionValues acceptedDefault
OffsetThe exact drawing position relative to the element's coordinates.Use the editor provided or read about positions. Use an array to assign a position to each element. 
Line ColorThe color used for the lines of the element.Use the editor provided or read about colors. Use an array to assign the color to each element. 
Line WidthThe thickness for the lines of the element.A constant or variable of type double or int indicates the thickness. Use an array to assign the thickness to each element.1

Methods

  • org.opensourcephysics.drawing2d.Element getElement(int index); returns the element in the set with that index. You may need to typecast the result to apply some methods, as in,

org.opensourcephysics.drawing2d.ElementSegment firstSegment = (org.opensourcephysics.drawing2d.ElementSegment) getElement(0);

Edit - History - Print - Recent Changes - Search
Page last modified on February 27, 2013, at 01:42 PM