jMonkeyEngine-Contributions / Lemur

Lemur is a jMonkeyEngine-based UI toolkit.
http://jmonkeyengine-contributions.github.io/Lemur/
BSD 3-Clause "New" or "Revised" License
116 stars 32 forks source link

Enhance controls with Swing style actions #90

Closed devent closed 4 years ago

devent commented 4 years ago

Hello. I am starting to use Lemur for my gui and there is some stuff I am missing.

For example, how would I react to the user finishing input a text in the TextField GUI element by pressing either Enter or Tab?

In Java Swing all components have Action(s) assigned to them and I can add an ActionListener that is informed with an ActionEvent after the user is finished entering or clicking on the field/button. See https://docs.oracle.com/javase/7/docs/api/javax/swing/JTextField.html#addActionListener(java.awt.event.ActionListener)

I would like to enhance Lemur components with Java Swing Action and ActionListener that will do so likewise. Java Swing Action would be the sensible choice because I don't like to re-implement all the classes and interfaces.

I also looked into ActionButton and it have an implementation of Action. But a) it doesn't follow the style approach of Lemur, i.e. I can't set the icon in the groovy-style file. b) I need to sub-class Action and I can't just add multiple ActionListener(s) to it.

Would be there any interest for that in Lemur? Is my assessment wrong in any part?

I just though that Java Swing would not be included in Android. Is that the reason why Lemur wasn't using that approach? That would make sense.

devent commented 4 years ago

How about Javafx EventHandler? There is a free Android port for Javafx: https://docs.gluonhq.com/javafxports/

pspeed42 commented 4 years ago

Is it possible for you to ask this question on the jMonkeyEngine forum?

Lemur's text field already supports actions similar to Swing.