Fixes issue where the TextArea component wasn't able to gain focus.
@@ -145,7 +145,7 @@ public class TextArea extends Component {
final MouseListener mouseListener = new MouseListener() {
@Override
public void mouseClicked(final MouseEvent e) {
- if (editable == false || isFocused() == false) {
+ if (editable == false) {
return;
}
@@ -153,6 +153,13 @@ public class TextArea extends Component {
return;
}
+ if (intersects(parentScreen.getMousePosition())) {
+ setFocused(true);
+ } else {
+ setFocused(false);
+ return;
+ }
+
final Font font = parentScreen.getImageCache().getFont();
final int columnIndexInArea = (e.getX() / font.getWidth()) - tiles.getXPosition();
final int rowIndexInArea = (e.getY() / font.getHeight()) - tiles.getYPosition();
