code: public static MouseAdapter mousePressed(@NonNull Consumer<MouseEvent> consumer) {
        return new MouseAdapter() {
           @Override
           public void mousePressed(MouseEvent e) {
              consumer.accept(e);
              super.mousePressed(e);
           }
        };
     }
docs: Mouse pressed mouse adapter.
  
  @param consumer the consumer
  @return the mouse adapter