may be 
Rectangle viewPortBounds = vp.getVisibleRect();
int widthOffset = viewPortBounds.getX() + (int) (viewPortBounds.getWidth() - backgroundComponent.getWidth()) / 2);