Suggestion List

Suggestion List

Released 5 years ago , Last update 5 years ago

A pluggable drop-down suggestion list primarily built for Swing text fields.

SuggestionList allows you to easily create autocomplete drop-down lists for your Swing text input fields. The list automatically displays and filters suggestions while the user types into the field.

SuggestionList can be easily integrated into your existing JTextField to auto-complete a user's keystrokes. All you have to do is to just create a data source for the list and then bind the list to a JTextField. When more content than the specified minimum prefix length is typed, a drop-down box is automatically activated to display suggestions on the bottom left of the text field. The list uses a data source model, SuggestionListModel, to maintain its data. The makes the source data able to be updated during run time even after the list was bound to a input field.

The list component is highly customizable and the API (fully Javadoc'ed) comes with a number of usable methods to configure/ tune the component for your unique usage.

Attention: This product has been discontinued and superseded by Autocomplete. It will be soon completely removed from the Marketplace.

Pricing

14 day 14-day money-back guarantee

$4.99

Personal License

  • Perpetual license

  • unlimited applications

  • Can distribute binary products only

  • Non-commercial use

$39.99

Developer License

  • Perpetual license

  • Unlimited projects

  • Can distribute code and binary products

  • Commercial use

  • 6 months support

Need custom services for this product? Get a quote

Features

  • Able to customize the drop-down list (e.g. border, font, background, foreground, renderer, visibleRowCount etc)
  • Able to set the maximum row count to display in the list
  • Dynamic data model that allows you to add and remove elements after initialization
  • Duplicate elements are automatically eliminated from the data model before they get to the displayed list
  • Automatically sorts the list items based on their String value into alphabetical order (case-insensitively)
  • Automatically filters the list for options that correspond to the content typed by the user
  • Automatically copies the value of a list item selected via the keyboard into the JTextField and restores the input when the selection is cancelled (using the Esc key)
  • Able to set the minimum prefix length, i.e. the number of characters that must be entered before prompting the suggestion list
  • Able to set the fetch interval, i.e. the time in milliseconds when the timer kicks in to refresh the suggestions in the list
  • Able to enable/ disable auto-selection (highlighting) of list item on mouse rollover
  • Able to set the list navigation mode, i.e. the way the list is being navigated via keyboard actions (navigation is rotatable by default, navigating past the last item in the list goes back to the first item and vice versa)
  • Able to register various listeners to listen for selection change events, selection acceptance events, mouse events, keyboard events and popup menu events
  • Able to unplug the suggestion list from the current JTextField and attach it to another at runtime

Usage Example

import java.awt.BorderLayout;
import javax.swing.*;
import ngjmy.swing.suggestionlist.SuggestionList;

public class TestSuggestionList extends JFrame {

    public TestSuggestionList() {
        JTextField jtf = new JTextField();
        String[] entries = {"sugar", "sugarcane", "sugared", "sugars", "sugary", "suggest", "suggested", "suggestible", "suggesting", "suggestion", "suggestive", "suggests"};

        /* Creates a suggestion list with a given array of data source */
        SuggestionList suggestionList = new SuggestionList(entries);
        /* Sets the minimum prefix length for the list */
        suggestionList.setMinimumPrefixLength(1);
        /* Sets the maximum row count to display in the list */
        suggestionList.setMaximumRowCount(10);
        /* Binds the suggestion list to the text field */
        suggestionList.bind(jtf);

        /* Adds the text field to the frame */
        add(jtf, BorderLayout.NORTH);
    }

    public static void main(String[] args) {
        JFrame frame = new TestSuggestionList();
        frame.setTitle("TestSuggestionList");
        frame.setSize(300, 200);
        frame.setLocationRelativeTo(null);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }
}

Installation

  1. Copy dist/SuggestionList.jar to the root directory of your application project.
  2. For Eclipse, in Package Explorer right click on SuggestionList.jar and select Build Path Add to Build Path. For Netbeans, in Project right-click on the project and select Properties. Go to Libraries, in Compile click Add JAR/ Folder and import SuggestionList.jar.
3 licenses, starting from From » $4.99 View Licenses

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.

or Get a quote

for customization or integration services


Or enter your name and Email