Adds a child PShape to a parent PShape that is defined as a GROUP. In the example, the three shapes path , rectangle , and circle are added to a parent PShape variable named house that is a GROUP. @webref pshape:method @webBrief Adds a new child @param who any variable of t
(PShape who)
| 2128 | * @see PShape#getChild(int) |
| 2129 | */ |
| 2130 | public void addChild(PShape who) { |
| 2131 | if (children == null) { |
| 2132 | children = new PShape[1]; |
| 2133 | } |
| 2134 | if (childCount == children.length) { |
| 2135 | children = (PShape[]) PApplet.expand(children); |
| 2136 | } |
| 2137 | children[childCount++] = who; |
| 2138 | who.parent = this; |
| 2139 | |
| 2140 | if (who.getName() != null) { |
| 2141 | addName(who.getName(), who); |
| 2142 | } |
| 2143 | } |
| 2144 | |
| 2145 | |
| 2146 | // adds child who exactly at position idx in the array of children. |
no test coverage detected