Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Add SpellChecker menu to existing oopup menu

Forum
Intertec
2011-10-26
2013-05-08
  • Intertec
    Intertec
    2011-10-26

    Hi,

    I can get the popup menu with the suggestions like that:

    JPopupMenu popup = SpellChecker.createCheckerPopup();
    text.addMouseListener(new PopupListener(popup));
    

    but it seems not possible to add another JMenuItem (like common copy/paste) to that popup menu. Is that right? Can that be done otherwise?

    Thanks for the great library. I use it for the Storybook project: http://sourceforge.net/projects/storybook2

     
  • i-net software
    i-net software
    2011-10-26

    If you use the suggestions menu directly then it is not possible. On every check it will cleared completely. But you can use the follow code with a submenu.

    JPopupMenu menu = new JPopupMenu();
    //.... add your own entries here
    menu.add( createCheckerMenu() );
    menu.add( createLanguagesMenu() );
    //.... add your own entries here
    text.addMouseListener( new PopupListener(menu) );
    
     
  • Intertec
    Intertec
    2011-10-28

    Many thanks for the quick reply, works fine!