void (Container parent) { Dimension size = myIcon.getPreferredSize(); Dimension preferredSize = myJLabel.getPreferredSize(); int width = getWidth(); int offset = width - size.width - 15 - preferredSize.width; myIcon.setBounds(offset, 0, size.width, size.height); myJLabel.setBounds(offset + size.width + 3, 0, preferredSize.width, size.height); }