KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nightlabs > editor2d > util > OrderUtil


1 package org.nightlabs.editor2d.util;
2
3 import org.nightlabs.editor2d.DrawComponent;
4 import org.nightlabs.editor2d.DrawComponentContainer;
5
6 public class OrderUtil
7 {
8     /**
9      *
10      * @param container the DrawComponentContainer to get the last index from
11      * @return the last index of the the given DrawComponentContainer
12      * @see DrawComponentContainer
13      */

14     public static int getLastIndex(DrawComponentContainer container)
15     {
16         return container.getDrawComponents().size() - 1;
17     }
18     
19     /**
20      *
21      * @param dc the DrawComponent to determine the index of
22      * @return the index of the DrawComponent in the drawComponents-List of its parent
23      */

24     public static int indexOf(DrawComponent dc)
25     {
26         return dc.getParent().getDrawComponents().indexOf(dc);
27     }
28 }
29
Popular Tags