AFrame.java<wbr style="line-height:25px"><wbr style="line-height:25px"><div style="line-height:25px">
<span style="line-height:25px">文件如下</span>:</div>
<div style="line-height:25px">
<div style="line-height:25px">
<span style="color:#000080; line-height:25px">public class</span><span style="line-height:25px"><span style="color:#000080; line-height:25px">AFrame</span></span>
</div>
<div style="line-height:25px">{</div>
<div style="line-height:25px"><br style="line-height:25px"></div>
<div style="line-height:25px"> int id = 0;</div>
<div style="line-height:25px"> int moduelCnt = 0;</div>
<div style="line-height:25px"> int kDefaultFModuleSizeMax = 500;</div>
<div style="line-height:25px"> FModule fModules[];</div>
<div style="line-height:25px"> String des = "";</div>
<div style="line-height:25px"> int rc_x = 0;</div>
<div style="line-height:25px"> int rc_y = 0;</div>
<div style="line-height:25px"> int rc_w = 0;</div>
<div style="line-height:25px"> int rc_h = 0;</div>
<div style="line-height:25px"> int w = 0;</div>
<div style="line-height:25px"> int h = 0;</div>
<div style="line-height:25px"><br style="line-height:25px"></div>
<div style="line-height:25px">
<span style="color:#0000FF; line-height:25px">AFrame()</span>
</div>
<div style="line-height:25px"> {</div>
<div style="line-height:25px"> fModules = new FModule[kDefaultFModuleSizeMax];</div>
<div style="line-height:25px"> }</div>
<div style="line-height:25px"><br style="line-height:25px"></div>
<div style="line-height:25px">
<span style="color:#0000FF; line-height:25px">AFrame(int fModulesize, String des)</span>
</div>
<div style="line-height:25px"> {</div>
<div style="line-height:25px"> fModules = new FModule[fModulesize];</div>
<div style="line-height:25px"> this.des = des;</div>
<div style="line-height:25px"> }</div>
<div style="line-height:25px"><br style="line-height:25px"></div>
<div style="line-height:25px">
<span style="color:#0000FF; line-height:25px">void appendModule(FModule fmodule)</span>
</div>
<div style="line-height:25px"> {</div>
<div style="line-height:25px"> fModules[moduelCnt++] = fmodule;</div>
<div style="line-height:25px"> int x1=rc_x;</div>
<div style="line-height:25px"> int y1=rc_y;</div>
<div style="line-height:25px"> int x2=rc_x+rc_w;</div>
<div style="line-height:25px"> int y2=rc_y+rc_h; </div>
<div style="line-height:25px"> if (fmodule.x < rc_x)</div>
<div style="line-height:25px"> {</div>
<div style="line-height:25px"> rc_x = fmodule.x;</div>
<div style="line-height:25px"> }</div>
<div style="line-height:25px"> if (fmodule.y < rc_y)</div>
<div style="line-height:25px"> {</div>
<div style="line-height:25px"> rc_y = fmodule.y;</div>
<div style="line-height:25px"> }</div>
<div style="line-height:25px"> if (fmodule.x+fmodule.w > x2)</div>
<div style="line-height:25px"> {</div>
<div style="line-height:25px"> x2 = fmodule.x+fmodule.w;</div>
<div style="line-height:25px"> }</div>
<div style="line-height:25px"> if (fmodule.y+fmodule.h > y2)</div>
<div style="line-height:25px"> {</div>
<div style="line-height:25px"> y2 = fmodule.y+fmodule.h;</div>
<div style="line-height:25px"> }</div>
<div style="line-height:25px"> rc_w=x2-rc_x;</div>
<div style="line-height:25px"> rc_h=y2-rc_y;</div>
<div style="line-height:25px"> }</div>
<div style="line-height:25px">}</div>
</div>
</wbr></wbr>