@Override public void mouseClicked(MouseEvent event){
  if (SwingUtilities.isRightMouseButton(event)) {
    JPopupMenu contextMenu=new JPopupMenu();
    JMenu colorMenu=new JMenu("Color");
    colorMenu.add(new ColorSettingMenuItem(mSettingsManager,ColorSettingName.SPECTRUM_CURSOR));
    colorMenu.add(new ColorSettingMenuItem(mSettingsManager,ColorSettingName.SPECTRUM_LINE));
    colorMenu.add(new ColorSettingMenuItem(mSettingsManager,ColorSettingName.SPECTRUM_BACKGROUND));
    colorMenu.add(new ColorSettingMenuItem(mSettingsManager,ColorSettingName.SPECTRUM_GRADIENT_BOTTOM));
    colorMenu.add(new ColorSettingMenuItem(mSettingsManager,ColorSettingName.SPECTRUM_GRADIENT_TOP));
    contextMenu.add(colorMenu);
    JMenu displayMenu=new JMenu("Display");
    contextMenu.add(displayMenu);
    JMenu averagingMenu=new JMenu("Averaging");
    averagingMenu.add(new AveragingItem(ChannelSpectrumPanel.this,2));
    displayMenu.add(averagingMenu);
    JMenu fftWidthMenu=new JMenu("FFT Width");
    displayMenu.add(fftWidthMenu);
    for (    DFTSize width : DFTSize.values()) {
      fftWidthMenu.add(new DFTSizeItem(mDFTProcessor,width));
    }
    JMenu frameRateMenu=new JMenu("Frame Rate");
    displayMenu.add(frameRateMenu);
    frameRateMenu.add(new FrameRateItem(mDFTProcessor,14));
    frameRateMenu.add(new FrameRateItem(mDFTProcessor,16));
    frameRateMenu.add(new FrameRateItem(mDFTProcessor,18));
    frameRateMenu.add(new FrameRateItem(mDFTProcessor,20));
    frameRateMenu.add(new FrameRateItem(mDFTProcessor,25));
    frameRateMenu.add(new FrameRateItem(mDFTProcessor,30));
    frameRateMenu.add(new FrameRateItem(mDFTProcessor,40));
    frameRateMenu.add(new FrameRateItem(mDFTProcessor,50));
    JMenu fftWindowType=new JMenu("Window Type");
    displayMenu.add(fftWindowType);
    for (    WindowType type : WindowType.values()) {
      fftWindowType.add(new FFTWindowTypeItem(mDFTProcessor,type));
    }
    JMenu smoothingMenu=new JMenu("Smoothing");
    if (mSpectrumPanel.getSmoothingType() != SmoothingType.NONE) {
      smoothingMenu.add(new SmoothingItem(ChannelSpectrumPanel.this,5));
      smoothingMenu.add(new JSeparator());
    }
    smoothingMenu.add(new SmoothingTypeItem(ChannelSpectrumPanel.this,SmoothingType.GAUSSIAN));
    smoothingMenu.add(new SmoothingTypeItem(ChannelSpectrumPanel.this,SmoothingType.TRIANGLE));
    smoothingMenu.add(new SmoothingTypeItem(ChannelSpectrumPanel.this,SmoothingType.RECTANGLE));
    smoothingMenu.add(new SmoothingTypeItem(ChannelSpectrumPanel.this,SmoothingType.NONE));
    displayMenu.add(smoothingMenu);
    if (contextMenu != null) {
      contextMenu.show(mOverlayPanel,event.getX(),event.getY());
    }
  }
}

@ Override public void mouseClicked ( MouseEvent event ) { if ( SwingUtilities . isRightMouseButton ( event ) ) { JPopupMenu contextMenu = new JPopupMenu ( ) ; JMenu colorMenu = new JMenu ( "Color" ) ; colorMenu . add ( new ColorSettingMenuItem ( mSettingsManager , ColorSettingName . SPECTRUM_CURSOR ) ) ; colorMenu . add ( new ColorSettingMenuItem ( mSettingsManager , ColorSettingName . SPECTRUM_LINE ) ) ; colorMenu . add ( new ColorSettingMenuItem ( mSettingsManager , ColorSettingName . SPECTRUM_BACKGROUND ) ) ; colorMenu . add ( new ColorSettingMenuItem ( mSettingsManager , ColorSettingName . SPECTRUM_GRADIENT_BOTTOM ) ) ; colorMenu . add ( new ColorSettingMenuItem ( mSettingsManager , ColorSettingName . SPECTRUM_GRADIENT_TOP ) ) ; contextMenu . add ( colorMenu ) ; JMenu displayMenu = new JMenu ( "Display" ) ; contextMenu . add ( displayMenu ) ; JMenu averagingMenu = new JMenu ( "Averaging" ) ; averagingMenu . add ( new AveragingItem ( ChannelSpectrumPanel . this , 2 ) ) ; displayMenu . add ( averagingMenu ) ; JMenu fftWidthMenu = new JMenu ( "FFT Width" ) ; displayMenu . add ( fftWidthMenu ) ; for ( DFTSize width : DFTSize . values ( ) ) { fftWidthMenu . add ( new DFTSizeItem ( mDFTProcessor , width ) ) ; } JMenu frameRateMenu = new JMenu ( "Frame Rate" ) ; displayMenu . add ( frameRateMenu ) ; frameRateMenu . add ( new FrameRateItem ( mDFTProcessor , 14 ) ) ; frameRateMenu . add ( new FrameRateItem ( mDFTProcessor , 16 ) ) ; frameRateMenu . add ( new FrameRateItem ( mDFTProcessor , 18 ) ) ; frameRateMenu . add ( new FrameRateItem ( mDFTProcessor , 20 ) ) ; frameRateMenu . add ( new FrameRateItem ( mDFTProcessor , 25 ) ) ; frameRateMenu . add ( new FrameRateItem ( mDFTProcessor , 30 ) ) ; frameRateMenu . add ( new FrameRateItem ( mDFTProcessor , 40 ) ) ; frameRateMenu . add ( new FrameRateItem ( mDFTProcessor , 50 ) ) ; JMenu fftWindowType = new JMenu ( "Window Type" ) ; displayMenu . add ( fftWindowType ) ; for ( WindowType type : WindowType . values ( ) ) { fftWindowType . add ( new FFTWindowTypeItem ( mDFTProcessor , type ) ) ; } JMenu smoothingMenu = new JMenu ( "Smoothing" ) ; if ( mSpectrumPanel . getSmoothingType ( ) != SmoothingType . NONE ) { smoothingMenu . add ( new SmoothingItem ( ChannelSpectrumPanel . this , 5 ) ) ; smoothingMenu . add ( new JSeparator ( ) ) ; } smoothingMenu . add ( new SmoothingTypeItem ( ChannelSpectrumPanel . this , SmoothingType . GAUSSIAN ) ) ; smoothingMenu . add ( new SmoothingTypeItem ( ChannelSpectrumPanel . this , SmoothingType . TRIANGLE ) ) ; smoothingMenu . add ( new SmoothingTypeItem ( ChannelSpectrumPanel . this , SmoothingType . RECTANGLE ) ) ; smoothingMenu . add ( new SmoothingTypeItem ( ChannelSpectrumPanel . this , SmoothingType . NONE ) ) ; displayMenu . add ( smoothingMenu ) ; if ( contextMenu != null ) { contextMenu . show ( mOverlayPanel , event . getX ( ) , event . getY ( ) ) ; } } }
displays the context menu .
