Closed kanashius closed 8 years ago
From your description, it seems more like a problem with TabPane than with RichTextFX to me. Do you think otherwise?
The Problem is, that TabPane set its content invisible, if the Tab is not shown. If the Tab changes, only the Scrollbars are set to visible (not recursive to the StyledTextArea, I think.) Maybe, it can be set visible, manually? (I looked up the source and think, you use List to display the text. I think, they are not set to visible, if CodeArea is set visible). I think its just bad-made by the Tab^^
I don´t know why, but I worked a littlebit and now its displayed... or not... Its just displayed sometimes, and sometimes not. I have no idea why, I will look for a reason... I´m loading files, when doubleclicked at a TreeView. The same File is Displayed sometimes, and Sometimes not...
Now I found the difference. The CodeArea is displayed in Tabs, when it have no scrollbars. If there are any scrollbars and its not opened in the first tab, the content is not visible. So I don´t think, its a problem of Tabs. But I don´t know.
Can you create a minimal self-contained test case that I can use to reproduce the problem?
I uploaded it at my Webside (.zip is not allowed here). I hope it helps :) http://kanashius.de/Downloads/codeAreaExample.zip
Thanks, but unfortunately I was not able to reproduce the problem. I simplified the example to a single java file. Could you please try to run this and report back whether you observe the same problem?
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.stage.Stage;
import org.fxmisc.richtext.CodeArea;
public class RichTextFXInTabPane extends Application {
// generate some text
private static final String TEXT1, TEXT2;
static {
StringBuilder sb1 = new StringBuilder();
StringBuilder sb2 = new StringBuilder();
for(int i = 0; i < 100; ++i) {
for(int j = 100; j > i; --j) {
sb1.append(i);
sb2.append(100-i);
}
sb1.append("\n");
sb2.append("\n");
}
TEXT1 = sb1.toString();
TEXT2 = sb2.toString();
}
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception{
TabPane pane = new TabPane(
new Tab("tab1", new CodeArea(TEXT1)),
new Tab("tab2", new CodeArea(TEXT2)));
primaryStage.setScene(new Scene(pane, 800, 600));
primaryStage.show();
}
}
Needed to rewrite TabPane pane = new TabPane( new Tab("tab1", new CodeArea(TEXT1)), new Tab("tab2", new CodeArea(TEXT2))); , tab konstruktor error, could not create Tab with sting and codearea. I made a Screenshot:
new Tab(String, Node)
constructor is only available sine 8u40, which is also the minimum recommended version for RichTextFX. There were some text rendering issues prior to 8u40 anyway, so I strongly suggest to upgrade.
Ok, didn´t saw that. I will update... thought I had the newest Version...
Closing this as it doesn't seem to be an issue in JDK 8u40 and later.
When I put CodeAreas in a Tab, the first Tab is shown correctly, the other Tabs with other CodeAreas show just the scrollbar, not the content. I think its the Problem, that they are marked at invisible and need to be set to visible (FIX: override setVisible, so that the content is visible, too) Code: