Skip to content

With tabs, only one tab shows text #113

@ghost

Description

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);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions