Skip to content

Latest commit

 

History

History
39 lines (32 loc) · 2.45 KB

README.md

File metadata and controls

39 lines (32 loc) · 2.45 KB

Java_Tree

The purpose of this project is to create visually apealing trees in Java using Trees data structures.

Change it to your liking!

It is easy modify many properties of the trees. Here is a list of the things you can change in this code.

  1. Number of child branches.
    Just add more Tree objects Tree tree = new Tree(15); to main.
   public static void main(String[] args) {
      Tree tree = new Tree(limit);
   }
  1. Size of trees
    use tree.setSize(size); to change the size of the tree.
  2. Positions
    use setPositionX(int positionX) and setPositionY(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.
  3. Angle position of trees
    use tree.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.
  4. Angle separation
    use tree.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.
  5. Delay between paintings
    The Tree class has a method slowMotion() 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 add delay(long delay) in the method drawTree() instead of using slowMotion(). Further development is needed easily switch between these settings at optimal performance.

Done!

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!

alt text