mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-10 10:20:44 -07:00
Formatting in edit menu + search fixes
This commit is contained in:
parent
ea724777ae
commit
973149e859
4 changed files with 125 additions and 123 deletions
|
|
@ -54,7 +54,7 @@ open class SearchField(
|
|||
text = text.dropLast(1)
|
||||
}
|
||||
} else if (e.keyChar == '\n') {
|
||||
onSearch(text)
|
||||
triggerSearch()
|
||||
} else {
|
||||
text += e.keyChar
|
||||
}
|
||||
|
|
@ -93,7 +93,6 @@ open class SearchField(
|
|||
override fun mouseClicked(e: MouseEvent) {
|
||||
if (e.x > width - 20 && e.y < 20) {
|
||||
text = ""
|
||||
onSearch(text)
|
||||
SwingUtilities.invokeLater {
|
||||
repaint()
|
||||
}
|
||||
|
|
@ -155,6 +154,15 @@ open class SearchField(
|
|||
text = newText
|
||||
repaint()
|
||||
}
|
||||
|
||||
|
||||
fun getText(): String = text
|
||||
}
|
||||
|
||||
private fun triggerSearch() {
|
||||
val query = text.trim()
|
||||
if (query.isNotEmpty()) {
|
||||
text = query
|
||||
repaint()
|
||||
onSearch(query)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue