Search in sources :

Example 6 with MovieView

use of org.apache.pivot.wtk.MovieView in project pivot by apache.

the class MovieViewSkin method layout.

@Override
public void layout() {
    MovieView movieView = (MovieView) getComponent();
    Movie movie = movieView.getMovie();
    if (movie != null) {
        int width = getWidth();
        int height = getHeight();
        int movieWidth = movie.getWidth();
        int movieHeight = movie.getHeight();
        switch(horizontalAlignment) {
            case CENTER:
                movieX = (width - movieWidth) / 2;
                break;
            case RIGHT:
                movieX = width - movieWidth;
                break;
            default:
                movieX = 0;
                break;
        }
        switch(verticalAlignment) {
            case CENTER:
                movieY = (height - movieHeight) / 2;
                break;
            case BOTTOM:
                movieY = height - movieHeight;
                break;
            default:
                movieY = 0;
                break;
        }
    }
}
Also used : Movie(org.apache.pivot.wtk.media.Movie) MovieView(org.apache.pivot.wtk.MovieView)

Aggregations

MovieView (org.apache.pivot.wtk.MovieView)6 Movie (org.apache.pivot.wtk.media.Movie)6 Dimensions (org.apache.pivot.wtk.Dimensions)1