protected Point computeLocation ( Rectangle viewport , Rectangle controls ) { double x ; double y ; if ( this . locationCenter != null ) { x = this . locationCenter . x - controls . width / 2 ; y = this . locationCenter . y - controls . height / 2 ; } else if ( this . position . equals ( AVKey . NORTHEAST ) ) { x = viewport . getWidth ( ) - controls . width - this . borderWidth ; y = viewport . getHeight ( ) - controls . height - this . borderWidth ; } else if ( this . position . equals ( AVKey . SOUTHEAST ) ) { x = viewport . getWidth ( ) - controls . width - this . borderWidth ; y = 0d + this . borderWidth ; } else if ( this . position . equals ( AVKey . NORTHWEST ) ) { x = 0d + this . borderWidth ; y = viewport . getHeight ( ) - controls . height - this . borderWidth ; } else if ( this . position . equals ( AVKey . SOUTHWEST ) ) { x = 0d + this . borderWidth ; y = 0d + this . borderWidth ; } else // use North East as default { x = viewport . getWidth ( ) - controls . width - this . borderWidth ; y = viewport . getHeight ( ) - controls . height - this . borderWidth ; } if ( this . locationOffset != null ) { x += this . locationOffset . x ; y += this . locationOffset . y ; } return new Point ( ( int ) x , ( int ) y ) ; }
Compute the screen location of the controls overall rectangle bottom right corner according to either the location center if not null or the screen position .