Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With tabs, only one tab shows text #113

Closed
ghost opened this issue Feb 15, 2015 · 7 comments
Closed

With tabs, only one tab shows text #113

ghost opened this issue Feb 15, 2015 · 7 comments

Comments

@ghost
Copy link

ghost commented Feb 15, 2015

Hi! Me again :)

It seems when I fill two tabs with a CodeArea and a lot of text (might have to be atleast a screen full??), the content of one of the two won't show.

See the following example.
Note: If you switch to the tab which isn't showing content, and then resize the window, it suddenly displays. But then the content of the other tab dissapears! :)

import java.io.IOException;
import java.security.SecureRandom;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

import org.fxmisc.richtext.CodeArea;

public class TestSample extends Application {

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

    @Override
    public void start(Stage primaryStage) throws IOException, InterruptedException {

        // Create some test data.
        final StringBuilder builder = new StringBuilder();
        final SecureRandom random = new SecureRandom();
        for (int line = 0; line < 24 * 5; line++) {
            for (int charPos = 0; charPos < 80; charPos++) {
                builder.append((char) ('A' + random.nextInt('Z' - 'A')));
            }
            builder.append("\n");
        }
        final String testData = builder.toString();

        // Setup the scene
        final CodeArea codeArea1 = new CodeArea();
        final Tab tab1 = new Tab("Tab1");
        tab1.setContent(codeArea1);

        final CodeArea codeArea2 = new CodeArea();
        final Tab tab2 = new Tab("Tab2");
        tab2.setContent(codeArea2);

        TabPane tabPane = new TabPane();
        tabPane.getTabs().add(tab1);
        tabPane.getTabs().add(tab2);

        final Scene scene = new Scene(new StackPane(tabPane), 600, 400);
        primaryStage.setScene(scene);
        primaryStage.show();

        // Add the test data
        codeArea1.appendText(testData);
        codeArea2.appendText(testData);
    }
}
@ghost
Copy link
Author

ghost commented Feb 15, 2015

Oh! versions:
jdk1.8.0_25 (64 bit)
org.fxmisc.richtext:richtextfx:0.6

@TomasMikula
Copy link
Member

Thanks for the sample code. I can reproduce this with JDK8u20. The problem no longer appears with JDK8u40-b23.

@JordanMartinez
Copy link
Contributor

I believe this was the same problem I encountered in my issue (#123). I'm currently using JDK8u31-b13 on Linux, so I'm not sure how to get the early release since mine is installed by PPA.

@TomasMikula
Copy link
Member

You can just download the tar file, unpack and add the bin subdirectory to the front of your PATH (to take precedence over the installed java).

In Eclipse, you can add a new JDK under Preferences -> Java -> Installed JREs -> Add -> Standard VM

@JordanMartinez
Copy link
Contributor

Sorry for responding so late. School just started up recently.

Thank you for the info! I'll try it soon.

@TomasMikula
Copy link
Member

Also, JDK 8u40 was officially released this week.

@ghost
Copy link
Author

ghost commented Mar 14, 2015

Yup, official JDK 8u40 fixes it for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants