Fixed ordering on Dictionary page
This commit is contained in:
parent
fa72ad88cb
commit
923db93fb3
1 changed files with 17 additions and 1 deletions
|
@ -23,6 +23,7 @@ import javafx.stage.Stage;
|
||||||
import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
|
import uk.ac.aber.cs22120.group20.json.DictionaryEntry;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class that handles the keyboard and mouse input and interaction for the 'Dictionary Page' which is
|
* A class that handles the keyboard and mouse input and interaction for the 'Dictionary Page' which is
|
||||||
|
@ -127,6 +128,21 @@ public class DictionaryController extends SharedCodeController {
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
|
english.setComparator(new Comparator<String>() {
|
||||||
|
@Override
|
||||||
|
public int compare(String s, String t1) {
|
||||||
|
s = s.toLowerCase();
|
||||||
|
t1 = t1.toLowerCase();
|
||||||
|
if (s.startsWith("to ")) {
|
||||||
|
return s.substring(3).compareTo(t1);
|
||||||
|
}
|
||||||
|
if (t1.startsWith("to ")) {
|
||||||
|
return s.compareTo(t1.substring(3));
|
||||||
|
}
|
||||||
|
return s.compareTo(t1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
currentPageIcon.setImage(new Image(getClass().getResourceAsStream("/assets/icons/white_icons/50px/read-50.png")));
|
currentPageIcon.setImage(new Image(getClass().getResourceAsStream("/assets/icons/white_icons/50px/read-50.png")));
|
||||||
currentPageText.setText("Dictionary");
|
currentPageText.setText("Dictionary");
|
||||||
|
|
||||||
|
|
Reference in a new issue