0

I was hoping there are other developers have similar issue that can share how to resolve this issue. I'm in the midst of using OpenJFX in one of my pet project. The project was tested on Oracle JDK 1.8 with JFX package included. When run on the Oracle 1.8 JDK, the TreeTableView show exactly as required:

enter image description here

Since Java 11 is required in my other workstation, the OpenJFX binary here is downloaded and installed. But the TreeTableView has become unreadable as followed:

enter image description here

Is there any JFX developer that has similar experiences?

FYI, I've tested with OpenJFX release 11.0.2, 15.0.1 and 16 all giving the same output.

Edit: It seems from the source behavior is as such as compile from source yield the same result.

Update: I should add my pet project is using JRuby and JRubyFX. Although not sure I don't think it is related to JRubyFX as the Oracle FX seems fine.

Thanks!

Regards

Chris Liaw
  • 67
  • 2
  • 9
  • Could you provide a [mre]? – Slaw Dec 01 '20 at 06:53
  • Hi the fastest is to use my pet project which is a jruby gems gvcsfx. If you're under jruby environment, just execute ```$ gem install gvcsfx```. After successfully install, you can start the gvcsfx GUI by typing ```$ gvcsfx```. The command shall open up window as the attached screenshot above. If the Java is Oracle JDK when the program is running, it will be using the Oracle JFX. If the Java is OpenJDK when the program is running, it will be using the OpenJFX, by looking for the env variable PATH_TO_FX that points to the OpenJFX release. Difference can be shown via this way. – Chris Liaw Dec 01 '20 at 07:48
  • Thing is, I have a feeling I've run across this problem before but I don't remember exactly. It might have been something to do with using graphics. Specifically, configuring the graphic in the `TreeItem` instead of the `TreeCell` / `TreeTableCell` seemed to be the problem (it was, in my opinion, a terrible API decision to give `TreeItem` a graphic property). But that being said, it doesn't look like you're using any graphics in your application so I don't know if any of what I said will be helpful. – Slaw Dec 01 '20 at 20:58
  • Graphic related could it be related to I have override the default TreeTableCell ? As [line 52-75 of this?](https://github.com/chrisliaw/gvcsfx/blob/master/handlers/workspace.rb) – Chris Liaw Dec 02 '20 at 07:13
  • 1
    I believe I only had the problem when I set the `TreeItem#graphic` property. But what happens if you set the `text` instead of the `graphic` of the cell? As an aside, why are you setting the `graphic` property to a `Text` node instead of directly setting the `text` property anyway? – Slaw Dec 02 '20 at 07:38
  • Hi @Slaw can you create an answer so that I can mark as resolved and fixed? Indeed changing the line from setGraphic to setText resolve the issue! Regarding why I set the graphic... I'm pretty new to JavaFX and I do have experience in Java Swing. I barely remembered Swing way is to setGraphic hence it is carried over. Thanks for your help! Waiting for your post on this. – Chris Liaw Dec 02 '20 at 08:02
  • Hmm, I'm not sure an answer is appropriate. I was merely speculating and there's no legitimate reason why `setText(...)` works while `setGraphic(new Text(...))` does not. In other words, this appears to be a bug in JavaFX. It would help the community if you could create a [mre] (in Java) and [submit a bug report](https://bugreport.java.com/bugreport/), assuming one doesn't already exist. – Slaw Dec 03 '20 at 07:55
  • But my post need a closure and your answer gave me that. :) I will benefit for other when they reach here too. – Chris Liaw Dec 04 '20 at 05:01
  • 1
    I've added a community answer. – Slaw Dec 04 '20 at 05:48

1 Answers1

1

From your repository you have:

class WorkspaceCellFactory < javafx.scene.control.TreeTableCell
  include Antrapol::ToolRack::ExceptionUtils
  def updateItem(itm,e)
    super

    cont = nil
    if not itm.nil? 
      if itm.is_a?(TreeWorkspace) 
        if not_empty?(itm.workspace)
          cont = itm.workspace.path
        elsif not_empty?(itm.project)
          cont = itm.project
        else
          cont = itm
        end
      else
        cont = itm
      end
    end

    setGraphic(Text.new(cont))

  end
end

You're setting the graphic property to a javafx.scene.text.Text node. In the past, I believe I've had a similar issue when using graphics with TreeView / TreeTableView. You've confirmed that replacing:

setGraphic(Text.new(cont))

With:

setText(cont)

Solves the problem.


Bug in JavaFX

This appears to be a bug in JavaFX. Please submit a bug report, assuming one doesn't already exist, so that the developers know there's a problem and can fix it. The bug report should include a minimal reproducible example written in Java.

Slaw
  • 37,820
  • 8
  • 53
  • 80
  • Thanks @Slaw for your answer! However the bug report link is linked to Oracle bug system. Is that a bug of JavaFX itself or the implementation? It does sound like Oracle behave this way but OpenJFX behave differently. Should I report to OpenJFX instead? – Chris Liaw Dec 04 '20 at 06:43
  • The link I gave will submit the bug to the JBS (Java Bug System). That is where you report bugs for OpenJFX (and OpenJDK, and so on). When creating the report you'll select "JavaFX" for the "Component". You can also include more run-time information in the box provided. @Chris – Slaw Dec 04 '20 at 07:39
  • 1
    I think the issue already reported to the bug database [here](https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8238991). Although the issue is marked closed but the comment seems link the issue to [another issue](https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8231644) which is remained open. I guess they are working on it then. – Chris Liaw Dec 07 '20 at 06:45