package sample; import javafx.scene.text.Text; import java.util.*; public class ThoughtManager { //Making it a singleton: private static final ThoughtManager INSTANCE = new ThoughtManager(); private ThoughtManager() {} public static ThoughtManager getInstance() { return INSTANCE; } //Singleton done. //VARIABLES: private List<Thought> thoughts = new ArrayList<>(); private Text textfield; //string NOTE! veit ikke om vi burde gjøre detta for i veit ikke ka man kan gjøre: private String text = new String(); public void makeList() { Thought t = new Thought("yeet1"); Thought t2 = new Thought("yeet12"); Thought t3 = new Thought("yeet3"); Thought t4 = new Thought("yeet4"); Thought t5 = new Thought("yeet5"); this.thoughts.add(t); this.thoughts.add(t2); this.thoughts.add(t3); this.thoughts.add(t4); this.thoughts.add(t5); } void initialize(Text text) { this.textfield = text; } void displayList() { this.textfield.setText(this.text); } void add(Thought thought) { this.thoughts.add(thought); this.text += thought.getThought() + "\n"; } void hurl() { this.text = ""; this.thoughts.clear(); } }