code: private void registerPopup(boolean allowCsvExport) {
          this.setComponentPopupMenu(popup);
          JMenuItem itemCopy = new JMenuItem("Copy Image to Clipboard");
          itemCopy.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kg/apc/jmeter/img/copy.png")));
          JMenuItem itemSave = new JMenuItem("Save Image as...");
          itemSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kg/apc/jmeter/img/save.png")));
          JMenuItem itemExport = new JMenuItem("Export to CSV...");
          itemExport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kg/apc/jmeter/img/export.png")));
          itemCopy.addActionListener(new CopyAction());
          itemSave.addActionListener(new SaveAction());
          itemExport.addActionListener(new CsvExportAction());
          popup.add(itemCopy);
          popup.add(itemSave);
          if (allowCsvExport) {
              popup.addSeparator();
              popup.add(itemExport);
          }
      }
docs: Thanks to stephane.hoblingre