code: @Override
      public void componentResized(final ComponentEvent EVENT) {
          final Container PARENT = getParent();
          if ((PARENT != null) && (PARENT.getLayout() == null)) {
              setSize(getWidth(), getHeight());
          } else {
              //setSize(new Dimension(getWidth(), getHeight()));
              setPreferredSize(new Dimension(getWidth(), getHeight()));
          }
  
          calcInnerBounds();
  
          if (getWidth() >= getHeight()) {
              // Horizontal
              setOrientation(Orientation.HORIZONTAL);
              recreateLedImages(getInnerBounds().height);
              recreateUserLedImages(getInnerBounds().height);
  
              if (isLedOn()) {
                  setCurrentLedImage(getLedImageOn());
              } else {
                  setCurrentLedImage(getLedImageOff());
              }
              setLedPosition((getInnerBounds().width - 20.0 - 16.0) / getInnerBounds().width, 0.453271028);
  
              if (isUserLedOn()) {
                  setCurrentUserLedImage(getUserLedImageOn());
              } else {
                  setCurrentUserLedImage(getUserLedImageOff());
              }
              setUserLedPosition(18.0 / getInnerBounds().width, 0.453271028);
          } else {
              // Vertical
              setOrientation(Orientation.VERTICAL);
              recreateLedImages(getInnerBounds().width);
              recreateUserLedImages(getInnerBounds().width);
  
              if (isLedOn()) {
                  setCurrentLedImage(getLedImageOn());
              } else {
                  setCurrentLedImage(getLedImageOff());
              }
              setLedPosition(0.453271028, (20.0 / getInnerBounds().height));
  
              if (isUserLedOn()) {
                  setCurrentUserLedImage(getUserLedImageOn());
              } else {
                  setCurrentUserLedImage(getUserLedImageOff());
              }
              setUserLedPosition((getInnerBounds().width - 18.0 - 16.0) / getInnerBounds().width, 0.453271028);
          }
          getModel().setSize(getLocation().x, getLocation().y, getWidth(), getHeight());
          init(getInnerBounds().width, getInnerBounds().height);
          revalidate();
          //repaint();
      }
docs: ComponentListener methods