I have tried so many different approaches and for some reason it just will not set the text in the textpane below is my current code
for (Component c : profilerscriptpanel.getComponents()) {
if (c instanceof JCheckBox) {
JCheckBox checkbox = (JCheckBox) c;
if (checkbox.isSelected()) {
String text = checkbox.getText();
File file = new File("Main/Scripts/" + text + ".txt");
try {
List<String> lines = Files.readAllLines(file.toPath());
StringBuilder sb = new StringBuilder();
for(String line: lines) {
sb.append(line);
sb.append(System.lineSeparator());
}
scriptparametertextbox.setText(sb.toString());
scriptparametertextbox.revalidate();
scriptparametertextbox.repaint();
scriptparametersavenametextbox.setText(text);
scriptparametersavenametextbox.revalidate();
scriptparametersavenametextbox.repaint();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}```
Any help is greatly appreciated