Is Google Suggests like functionality possible in Java SWT?

nik7 :

I want a drop down ComboBox like Google Search (i.e. when we type one letter then the elements starting with that letter are displayed). When the drop down list appears, then we can select one of word as our text box value.

Can I do this in SWT?

comboLabel.addKeyListener(new KeyListener()
{
    @Override
    public void keyReleased(KeyEvent e)
    {
        ArrayList<String> listElements = new ArrayList<String>();
        // on pressing down arrow list gets expanded i.e list drops down
        if(e.keyCode == 16777218)
        {
            comboLabel.setListVisible(true);
        }
        // if key pressed is only a number of charecter or space.
        else if ((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 97 && e.keyCode <= 122) || e.keyCode == 32)
        {
            // for removing all previously assigned labels
            comboLabel.remove(0,comboLabel.getItemCount()-1);
            listElements = labels.getLabels(comboLabel.getText());
        }

        for (int i=0; i<listElements.size();i++)
        {
            comboLabel.add(listElements.get(i),i);
        }
    }
});
Abbas :

What you are referring to is an auto-suggest ComboBox. As far as I know, it's not available in any Java standard widget library. However, a lot of people have built their own auto-suggest component. Here's a good example with both source and an executable ".jnlp" extension.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Scipy-like functionality in Java / Scala?

Is it possible to add tab-like functionality to tmux panes?

Is it possible to override functionality with a mixin-like pattern in c++

Exception in thread (Task) is not propagated like example suggests

Is it possible to create an RPZ (or similar functionality) with Google Cloud DNS?

is it possible to write words on other pages like google search box from java programs

How to write the best possible Java code for a similar Ruby functionality?

StorageItemAccessList like functionality in Android

PIVOT like functionality

Pencil-like functionality

Like functionality in Django

Is it possible to use struct-like constructs in Java?

Is it possible to build custom GUI like this in Java?

Is it possible to extend Evernote functionality?

Is possible to change functionality of "./" on linux?

SWT Application: Are Draggable Tabs Possible?

Is it possible to add more information/functionality than just a title in a marker in Google Maps?

Is it possible to track hash links like pages with google analytics?

Is it possible to define a schema for Google Pub/Sub topics like in Kafka with AVRO?

Implement Sliding Drawer like functionality

TreeView with FileSystemModel-like Functionality?

Gmail like notification functionality android

SQL Server LAST like functionality

Implement Tag functionality like Instagram?

Deriving newtype recursively like functionality

Image Map -like functionality in Flutter?

MomentJS like functionality for Android Apps

Create like/unlike functionality with Laravel

dig-like functionality on windows?

TOP Ranking

HotTag

Archive