If you start a brand new codename one project (bare bone )
You can try replacing the start() function with this one:
Basically, I create a new form, I create a side menu with 2 commands. Also I create a command listener. If one of the side menu is selected, I display the AutcompleteTextField , if the other commands get selected then some other content is displayed.
If you alternate between the two commands back and forth while searching , you will see that the pop up will slide down further when we navigate away and come back to it.
NOTE: one interesting observation, on start up on the first time around , the pop up is already detached from the text field but it looks close enough. I am not sure why it keeps sliding down since it is bascially the exact same code we are loading given that I call hi.removeAll() at the beginning.
I seriously appreciate any guidance or workaround as my design really requires a side menu and an autocompelteTextField that I am using along side with Google address search.
`public void start() {
if (current != null) {
current.show();
return;
}
Form hi = new Form("Hi World");
Toolbar bar = new Toolbar();
hi.setToolbar(bar);
Command test1 = new Command("Test 1");
Command test2 = new Command("Test 2");
bar.addCommandToSideMenu(test1);
bar.addCommandToSideMenu(test2);
hi.setLayout(new BorderLayout());
hi.addCommandListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
if (evt.getCommand().getCommandName().equals("Test 1")) {
hi.removeAll();
String[] completion = new String[]{"abcdef", "bbcdef", "ccdef", "dd", "ef", "f"};
AutoCompleteTextField search = new AutoCompleteTextField(completion);
hi.addComponent(BorderLayout.NORTH, search);
hi.repaint();
hi.revalidate();
} else {
hi.removeAll();
hi.addComponent(BorderLayout.NORTH, new Label("Welcome to test2"));
hi.repaint();
hi.revalidate();
}
}
});
hi.show();
}`
If you start a brand new codename one project (bare bone ) You can try replacing the start() function with this one: Basically, I create a new form, I create a side menu with 2 commands. Also I create a command listener. If one of the side menu is selected, I display the AutcompleteTextField , if the other commands get selected then some other content is displayed.
If you alternate between the two commands back and forth while searching , you will see that the pop up will slide down further when we navigate away and come back to it.
NOTE: one interesting observation, on start up on the first time around , the pop up is already detached from the text field but it looks close enough. I am not sure why it keeps sliding down since it is bascially the exact same code we are loading given that I call hi.removeAll() at the beginning.
I seriously appreciate any guidance or workaround as my design really requires a side menu and an autocompelteTextField that I am using along side with Google address search.
`public void start() { if (current != null) { current.show(); return; } Form hi = new Form("Hi World"); Toolbar bar = new Toolbar(); hi.setToolbar(bar); Command test1 = new Command("Test 1"); Command test2 = new Command("Test 2"); bar.addCommandToSideMenu(test1); bar.addCommandToSideMenu(test2); hi.setLayout(new BorderLayout());