@@ -37,6 +37,8 @@ public final class BrowserCanvas extends Canvas implements CommandListener {
3737 private int selectedSpeedDial = -1 ;
3838 private final Command renameSpeedDialCommand = new Command ("Rename" , Command .SCREEN , 1 );
3939 private final Command deleteSpeedDialCommand = new Command ("Delete" , Command .SCREEN , 2 );
40+ private final Command moveSpeedDialUpCommand = new Command ("Move Up" , Command .SCREEN , 3 );
41+ private final Command moveSpeedDialDownCommand = new Command ("Move Down" , Command .SCREEN , 4 );
4042 private String [] bookmarkUrls = new String [0 ];
4143 private TextBox bookmarkRenameBox ;
4244 private TextBox speedDialRenameBox ;
@@ -162,6 +164,17 @@ public void commandAction(Command command, javax.microedition.lcdui.Displayable
162164 }
163165 return ;
164166 }
167+ if ((command == moveSpeedDialUpCommand || command == moveSpeedDialDownCommand ) &&
168+ "Speed Dial" .equals (chooser .getTitle ())) {
169+ int selected = chooser .getSelectedIndex ();
170+ if (selected >= 0 && selected < speedDialUrls .length ) {
171+ int direction = command == moveSpeedDialUpCommand ? -1 : 1 ;
172+ status = speedDial .move (speedDialUrls [selected ], direction )
173+ ? "Speed Dial order updated" : "Already at list boundary" ;
174+ showSpeedDial ();
175+ }
176+ return ;
177+ }
165178 if (command == renameBookmarkCommand && "Bookmarks" .equals (chooser .getTitle ())) {
166179 selectedBookmark = chooser .getSelectedIndex ();
167180 if (selectedBookmark >= 0 && selectedBookmark < bookmarkUrls .length ) {
@@ -430,6 +443,8 @@ private void showSpeedDial() {
430443 if (entries .length == 0 ) chooser .append ("No Speed Dial entries" , null );
431444 chooser .addCommand (renameSpeedDialCommand );
432445 chooser .addCommand (deleteSpeedDialCommand );
446+ chooser .addCommand (moveSpeedDialUpCommand );
447+ chooser .addCommand (moveSpeedDialDownCommand );
433448 chooser .addCommand (new Command ("Back" , Command .BACK , 3 ));
434449 chooser .setCommandListener (this );
435450 Display .getDisplay (midlet ).setCurrent (chooser );
0 commit comments