private void calculateNewDimenstions(OpenPatricianRadioButton radioButton, String text, Image rbBG) { InputStream is; final int remainWidth = 28; // width that is left from the background final int destHight = 27; final double xStart = rbBG.getWidth(); final int yStart = 0; Dimension2D dim = sizing.calculate(text, radioButton.getFont()); double width = dim.getWidth(); double destWidth = width-remainWidth + 10; String fileName = imageFactory.getFileNameExt(destWidth,destHight,remainWidth); is = getClass().getResourceAsStream(fileName); Image slab = new Image(is, destWidth, destHight, false, true); slabView.setImage(slab); slabView.translateXProperty().set(xStart); slabView.translateYProperty().set(yStart); double posX = destWidth/2+(xStart-remainWidth-10); label.translateXProperty().set(posX); }