Default methods in JFX-8

Petr Pchelko petr.pchelko at
Thu Oct 3 11:24:26 PDT 2013

Hello, OpenJFX Community.

There's a question about using Java 8 features in FX.

I've been working on the support for InputMethods in JFXPanel which is an important feature for many users who speak hieroglyphic languages.
The issue is tracked under:

In order to have a high-quality support we need to change javafx.scene.input.InputMethodRequests interface and introduce 3 new methods. This is not needed for pure FX applications right now, but absolutely required for InputMethods in the JFXPanel. However, the interface is public and it was present since FX2.0, so changing it would become a breaking change. So the only way to avoid the problem is using the default methods. Those would return some stub values, the JDK is OK with that, as it would not crash or throw exceptions, but text composition would not work correctly. 

I know that we want to avoid using the Java 8 features in the JFX-8, so I wanted to ask - is it OK to use the default methods here? 

Here's the questioned API:

 * Returns the offset of the return position in the committed text contained in the text editing node
default int getInsertPositionOffset() { return 0;}

 * Gets the entire text contained in the text editing node except the uncommitted text.
default String getCommitedText(int begin, int end) {return "";}

 * Gets the length of the entire text contained in the text editing node
default int getCommitedTextLength() {return 0;}

Thank you.
With best regards. Petr.

More information about the openjfx-dev mailing list