Hello all,
Im having an issue with a ScrollPane. I add the ScrollPane by code and also add its content by code.
The content becomes blurry, a big problem especially with text.
So I googled a bit and found the solution for this. First I tried it with Integer-only positioning values but this didnt work. Then I found a Java Code for fixing this:
The forum user that posted this code commented this code with:
I dont know anything about Java. Can somebody help me that I can use this code inside B4J?
Im having an issue with a ScrollPane. I add the ScrollPane by code and also add its content by code.
The content becomes blurry, a big problem especially with text.
So I googled a bit and found the solution for this. First I tried it with Integer-only positioning values but this didnt work. Then I found a Java Code for fixing this:
B4X:
import com.sun.javafx.scene.control.skin.ScrollPaneSkin;
import java.lang.reflect.Field;
import javafx.scene.Node;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.StackPane;
public class FieldUtils {
public static void fixBlurryText(Node node) {
try {
Field field = ScrollPaneSkin.class.getDeclaredField("viewRect");
field.setAccessible(true);
ScrollPane scrollPane = (ScrollPane) node.lookup(".scroll-pane");
StackPane stackPane = (StackPane) field.get(scrollPane.getSkin());
stackPane.setCache(false);
} catch (NoSuchFieldException | SecurityException | IllegalAccessException e) {
e.printStackTrace();
}
}
}
The forum user that posted this code commented this code with:
I checked the internal skin code and found a workaround, not pretty though. The problem is inside com.sun.javafx.scene.control.skin.ScrollPaneSkin, which calls viewRect.setCache(true). Disabling cache appears to solve the problem.
I dont know anything about Java. Can somebody help me that I can use this code inside B4J?