void () { setLayout(new BorderLayout(getIcon() == null ? 0 : getIconTextGap(), 0)); int position = getHorizontalTextPosition(); String iconConstraint = getComponentOrientation().isLeftToRight() ? BorderLayout.WEST : BorderLayout.EAST; if (getComponentOrientation().isLeftToRight() && position == SwingConstants.LEADING) iconConstraint = BorderLayout.EAST; if (!getComponentOrientation().isLeftToRight() && position == SwingConstants.TRAILING) iconConstraint = BorderLayout.EAST; if (position == SwingConstants.LEFT) iconConstraint = BorderLayout.EAST; add(myIconLabel, iconConstraint); add(myEditorPane, BorderLayout.CENTER); }