Attempting to add focus
it doesnt work but still
This commit is contained in:
parent
6e1b0e3f69
commit
7e852ff05f
@ -32,7 +32,7 @@ public class Button extends Component {
|
|||||||
this.font = font;
|
this.font = font;
|
||||||
this.text = text;
|
this.text = text;
|
||||||
setPreferredSize(107,34);
|
setPreferredSize(107,34);
|
||||||
//super.addListener(onClickClass, onClick);
|
Button inButton = (Button) setFocusable(true);
|
||||||
|
|
||||||
addListener(new Object() {
|
addListener(new Object() {
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@ -44,12 +44,11 @@ public class Button extends Component {
|
|||||||
addListener(new Object() {
|
addListener(new Object() {
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onFocusChanged(FocusEvent e) {
|
public void onFocusChanged(FocusEvent e) {
|
||||||
|
inButton.setText(e.getNewState() ? "Is Focused" : "Isn't focused");
|
||||||
requestReassembly();
|
requestReassembly();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Button inButton = this;
|
|
||||||
|
|
||||||
addListener((Class<KeyEvent>) KeyEvent.class, (InputListener<KeyEvent>) e -> {isClicked = e.isPress();
|
addListener((Class<KeyEvent>) KeyEvent.class, (InputListener<KeyEvent>) e -> {isClicked = e.isPress();
|
||||||
if (!inButton.isDisabled())
|
if (!inButton.isDisabled())
|
||||||
onClick.accept(inButton);
|
onClick.accept(inButton);
|
||||||
@ -65,6 +64,7 @@ public class Button extends Component {
|
|||||||
public void setDisable(boolean isDisabled)
|
public void setDisable(boolean isDisabled)
|
||||||
{
|
{
|
||||||
this.isDisabled = isDisabled;
|
this.isDisabled = isDisabled;
|
||||||
|
setFocusable(isDisabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDisabled()
|
public boolean isDisabled()
|
||||||
|
Reference in New Issue
Block a user