Autocompletion stops after entering one word using JSuggestField - SSCCE attached

7331

New Member
I added to my project the element of autocompletion; but after the user has entered one word, the autocompletion algorithm stops. I can add more characters, however without the autocompltion's suggestions.I'm using \[code\]JSuggestField\[/code\] (added the jar to my project) , here is SSCCE that illustrates the problem : \[code\]import javax.swing.*;import ch.rakudave.suggest.JSuggestField;import java.awt.*;import java.util.Vector;public class Classic extends JFrame {public static final String CHILD = "/child::";public static final String DESCENDANT = "/descendant::";public static final String FOLLOWING_SIBLING = "/following-sibling::";public static final String DESCENDANT_OR_SELF = "/descendant-or-self::";public static final String SELF = "/self::";public static final String PRECEDING_SIBLING = "/preceding-sibling::";public static final String ANCESTOR_OR_SELF = "/ancestor-or-self::";public static final String ANCESTOR = "/ancestor::";public static final String FOLLOWING = "/following::";public static final String PRECEDING = "/preceding::";public Classic() { initComponents();}private void initComponents() { Vector<String> vector = new Vector<String>(); vector.add(DESCENDANT); vector.add(FOLLOWING_SIBLING); vector.add(DESCENDANT_OR_SELF); vector.add(SELF); vector.add(PRECEDING_SIBLING); vector.add(ANCESTOR_OR_SELF); vector.add(ANCESTOR); vector.add(FOLLOWING); vector.add(PRECEDING); JSuggestField jsuggest= new JSuggestField(this,vector ); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(200, 200); Container container = getContentPane(); container.setLayout(new FlowLayout(FlowLayout.LEFT)); JTextField textField = new JTextField(15); jsuggest.setPreferredSize(new Dimension(100, 20)); // // Right justify the JTextField contents // jsuggest.setHorizontalAlignment(JTextField.RIGHT); container.add(jsuggest); textField = jsuggest;}public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new Classic().setVisible(true); } });}}\[/code\]Here is a snapshot :
SfsNL.gif
.This is nice , but I want that the autocompletion would work after each time the user has entered the character \[code\]/\[/code\], hence one autocompletion is not enough. Any idea how can I solve this using \[code\]JSuggestField\[/code\] or something else? Thanks.
 
Back
Top