void () { super.layoutButtons(); if (myDropPlace == null) return; Rectangle bounds = myButton.getBounds(); Dimension size = myDropPlace.getPreferredSize(); int gap = JBUI.scale(2); setPreferredSize(new Dimension(bounds.width + size.width + 2 * gap, bounds.height)); myDropPlace.setBounds((int)(bounds.getMaxX() + gap), bounds.y + (bounds.height - size.height) / 2, size.width, size.height); }