FXMisc / Flowless

Efficient VirtualFlow for JavaFX
BSD 2-Clause "Simplified" License
185 stars 38 forks source link

Modular application cannot find flowless #101

Closed ghost closed 2 years ago

ghost commented 2 years ago

Environment

Problem

Created a simple application that works with RichTextFX. Added a VirtualizedScrollPane, but IntelliJ reports the following problems:

Is there a minimal example showing how to use Flowless + RichTextFX + JDK 17 + Gradle 7.2?

The relevant files are below.

module-info.java

module com.keenwrite.editor {
    requires javafx.controls;
    requires javafx.fxml;
    requires org.fxmisc.richtext;

    // Is this line correct? If not, what module is required?
    requires org.fxmisc.flowless;

    opens com.keenwrite.editor to javafx.fxml;
    exports com.keenwrite.editor;
}

HelloApplication.java

package com.keenwrite.editor;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;
import org.fxmisc.richtext.StyleClassedTextArea;

public class HelloApplication extends Application {
    @Override
    public void start(final Stage stage) {
        final var area = new StyleClassedTextArea();
        area.requestFollowCaret();
        area.setWrapText(true);

        // The IDE cannot find the class to import, despite the module being found.
        final var scrollPane = new VirualizedScrollPane(area);

        final var scene = new Scene(area, 400, 400);
        stage.setScene(scene);
        stage.show();
    }

    public static void main(final String[] args) {
        launch();
    }
}

build.gradle

plugins {
    id 'java'
}

repositories {
    mavenLocal()
    mavenCentral()
}

dependencies {
    implementation 'org.fxmisc.richtext:richtextfx:0.10.7'
    implementation 'org.fxmisc.flowless:flowless:0.6.7'

    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
    testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}

group = 'com.keenwrite'
version = '1.0-SNAPSHOT'
description = 'editor'
java.sourceCompatibility = JavaVersion.VERSION_17

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

settings.gradle

rootProject.name = 'editor'
Jugen commented 2 years ago

flowless hasn't been modularized yet.

In the meantime here's the latest flowless-0.6.7.zip version with an automatic module entry in it's manifest (just rename the zip to jar), that you can try if you wish.

Note that flowless depends on another library org.reactfx that isn't modularized either, not sure if that'll be a problem ?