diff options
| author | Martin Robertz <dream-master@gmx.net> | 2020-06-04 16:36:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-04 16:36:59 +0200 |
| commit | 2f3676ff64faa743ea2ac4e558f6537146088cd6 (patch) | |
| tree | 7b72857681f87f502f48f39af2fb3e5c5c5a2d74 /src/main/java/gregtech/api/gui/GT_GUICover.java | |
| parent | e962a457e49216f6b3c8326433cace302c137485 (diff) | |
| parent | 0e2794bb58cce84b5daf7fd85a124550fff6de4c (diff) | |
| download | GT5-Unofficial-2f3676ff64faa743ea2ac4e558f6537146088cd6.tar.gz GT5-Unofficial-2f3676ff64faa743ea2ac4e558f6537146088cd6.tar.bz2 GT5-Unofficial-2f3676ff64faa743ea2ac4e558f6537146088cd6.zip | |
Merge pull request #300 from moller21/cover_guis
Cover guis
Diffstat (limited to 'src/main/java/gregtech/api/gui/GT_GUICover.java')
| -rw-r--r-- | src/main/java/gregtech/api/gui/GT_GUICover.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/gregtech/api/gui/GT_GUICover.java b/src/main/java/gregtech/api/gui/GT_GUICover.java index 94346186a8..f1232c9432 100644 --- a/src/main/java/gregtech/api/gui/GT_GUICover.java +++ b/src/main/java/gregtech/api/gui/GT_GUICover.java @@ -157,8 +157,10 @@ public abstract class GT_GUICover extends GuiScreen implements GT_IToolTipRender public void mouseClicked(int x, int y, int button) { for (GT_GuiIntegerTextBox tBox : textBoxes) { boolean hadFocus = tBox.isFocused(); - tBox.mouseClicked(x,y,button); - if (tBox.isFocused() && button == 1) //rightclick -> lcear it + if (tBox.isEnabled() || hadFocus) + tBox.mouseClicked(x,y,button); + + if (tBox.isFocused() && button == 1 && tBox.isEnabled()) //rightclick -> lcear it tBox.setText("0"); else if (hadFocus && !tBox.isFocused()) applyTextBox(tBox); @@ -193,6 +195,9 @@ public abstract class GT_GUICover extends GuiScreen implements GT_IToolTipRender return; } } + if (textBoxes.size() > 0 ) + setFocusedTextBox(textBoxes.get(0)); + return; } if (focusedTextBox != null && focusedTextBox.textboxKeyTyped(c, key)){ @@ -239,7 +244,7 @@ public abstract class GT_GUICover extends GuiScreen implements GT_IToolTipRender */ private void setFocusedTextBox(GT_GuiIntegerTextBox boxToFocus) { for (GT_GuiIntegerTextBox textBox : textBoxes) { - textBox.setFocused(textBox.equals(boxToFocus)); + textBox.setFocused(textBox.equals(boxToFocus) && textBox.isEnabled()); } } public void applyTextBox(GT_GuiIntegerTextBox box) { |
