Hello,
I have a B4XPages code that is using specific java routines only for B4J. If compiled for B4A the routine raises an error that's why it's needed to restrict the compilation only to B4J.
But compiler in B4A is ignoring the directive as follows:
Is there any way to reference a java function only for B4J?
Thanks!
I have a B4XPages code that is using specific java routines only for B4J. If compiled for B4A the routine raises an error that's why it's needed to restrict the compilation only to B4J.
But compiler in B4A is ignoring the directive as follows:
B4X:
#if B4J
#if Java
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import javafx.scene.text.Font;
import javafx.scene.text.TextBoundsType;
public static double MeasureMultilineTextHeight(Font f, String text, double width) throws Exception {
Method m = Class.forName("com.sun.javafx.scene.control.skin.Utils").getDeclaredMethod("computeTextHeight",
Font.class, String.class, double.class, TextBoundsType.class);
m.setAccessible(true);
return (Double)m.invoke(null, f, text, width, TextBoundsType.LOGICAL_VERTICAL_CENTER);
}
#End If
#END IF
Is there any way to reference a java function only for B4J?
Thanks!