The purpose of this project is to create visually apealing trees in Java using Trees data structures.
It is easy modify many properties of the trees. Here is a list of the things you can change in this code.
- Number of child branches.
Just add more Tree objectsTree tree = new Tree(15);
to main.
public static void main(String[] args) {
Tree tree = new Tree(limit);
}
- Size of trees
usetree.setSize(size);
to change the size of the tree. - Positions
usesetPositionX(int positionX)
andsetPositionY(int positionY)
to set position of the root branch. The value of X starts at 0 and increases from left to right of your screen, while the Y value starts at 0 and increases from top to bottom of your screen. - Angle position of trees
usetree.setTreeAngle(angle);
to set the angle of the tree. Angle is measured in counter-clockwise degrees, where 0 is the right-most of the screen and 180 is the left-most of the screen. - Angle separation
usetree.setSeparationAngle(Angle);
to set the angle seperation between branches. This angle will dictate how far appart should each branch be from its sibling branch. You can get funny/interesiting looking trees if you play with this property. Try setting it to 60, 90, or more if you want to have crazy looking trees. - Delay between paintings
The Tree class has a methodslowMotion()
which aesthetically draws the tree, by reducing the time between frames. If you wish to use a constant time between frames you have to manually adddelay(long delay)
in the methoddrawTree()
instead of usingslowMotion()
. Further development is needed easily switch between these settings at optimal performance.
Note: All setting might be overwritten if the safety is on.
After you are done editing your tree, just call tree.draw(boolean safety);
to draw it!