Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Commit

Permalink
Fix autocompleteing combo boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
NotToDisturb committed Nov 29, 2020
1 parent 3357119 commit e097c62
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .idea/artifacts/Decomp_Trainer_Editor_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: me.disturbo.main.MainActivity

8 changes: 6 additions & 2 deletions src/me/disturbo/ui/extensions/ComboBoxFiltered.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ private final void configFocus(){
@Override
public void focusGained(FocusEvent e) {
// Base case
if(!showAll.equals("")) setModel(new DefaultComboBoxModel(getFilteredElements(field.getText())));
if(!showAll.equals("")){
String text = field.getText();
setModel(new DefaultComboBoxModel(getFilteredElements(field.getText())));
setSelectedItem(text);
}
setPopupVisible(true);
}

Expand Down Expand Up @@ -103,7 +107,7 @@ private final void autocomplete(JTextField field){
String[] filtered = getFilteredElements(text);
if(filtered.length == 0) filtered = elements.toArray(new String[0]);
if(!showAll.equals("")) setModel(new DefaultComboBoxModel(filtered));
setSelectedItem(filtered[0]);
setSelectedItem(this.elements.contains(text) ? text : filtered[0]);
}

private final String[] getFilteredElements(String text){
Expand Down
1 change: 0 additions & 1 deletion src/me/disturbo/ui/party/PartyMemberPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,5 @@ public final void savePartyMemberData(PartyMember member){
moves.add(keys.get(indexOfMove));
}
member.moves = moves;
System.out.println(member.species + " " + member.heldItem.equals(""));
}
}

0 comments on commit e097c62

Please sign in to comment.