how to position element ? (client side component development question)

hello vaadiners

Have a problem which I haven’t been able to solve on my own

basically I would like to position labels (a task and its caption) in an absolutepanel in a way that the task starts at a certain x position , and its caption is on its right ( so the caption right and the task left edge is at the same x position )

here is my code, and I attached a screenshot about what I would like to achieve

                displayComponentPanel.add(eventElement, (int) x, (int) y);
		int eventCaptionWidth = eventCaption.getOffsetWidth();
		displayComponentPanel.setWidgetPosition(eventCaption,(int) x-eventCaptionWidth,(int) y);

displayComponentPanel is a gwt absolutepanel, eventElement and eventCaption are gwt labels

what is wrong with my code ?

how can I position the elements properly?