code: private void attachToLayeredPane() {
          // Get ancestor layered pane that will get the decoration holder component
          Container ancestor = SwingUtilities.getAncestorOfClass(JLayeredPane.class, decoratedComponent);
          if (ancestor instanceof JLayeredPane) {
              attachedLayeredPane = (JLayeredPane) ancestor;
              Integer layer = getDecoratedComponentLayerInLayeredPane(attachedLayeredPane);
              attachedLayeredPane.remove(decorationPainter);
              attachedLayeredPane.add(decorationPainter, layer);
          } else {
              // Remove decoration painter from previous layered pane as this could lead to memory leak
              detachFromLayeredPane();
          }
      }
docs: Inserts the decoration to the layered pane right above the decorated component.