I would like to introduce the GUI similar to the previous example.
- On the left side, there are a collection of paragraphs (instances of the Paragraph class) that contain a collection of words (Strings). As you can see – in the text, there are highlighted text fragments (green, orange, blue).
- The text fragment is subcollection of words from concrete paragraph.
- On the right side, there are a collection of facts (instances of the Fact class).
- Each fact is associated with at least one text fragment (there may be more – e.g. Fact #2).
Code fragments:
public class Paragraph {
private List<String> words;
…
}
public class Fact {
private String text;
…
}
I wish that this will be an interactive GUI (user can click on the text fragment => e.g. corresponding fact will be pop-uped / user can click on the fact => e.g. only corresponding text fragments stay highlighted).
Due to this, it is necessary that each text fragment knows corresponding fact and vice versa.
How to achieve the linkage between the text fragments and the corresponding fact in Java and what are appropriate data-structures?
I mean the data model of this linkage, not the GUI implementation. I suppose the word count is much higher than the number of text fragments.