private static void cutWidth(@NotNull Component component, @NotNull Dimension size, int width) {
      size.width = width;
      component.setPreferredSize(size);
      if (component instanceof JButton button) {
        button.setToolTipText(button.getText());
      }
      else if (component instanceof JLabel label) {
        label.setToolTipText(label.getText());
      }
    }
private static void cutWidth(@NotNull Component component, @NotNull Dimension size, int width)