Please help me =(
I'm not native english speaker, therefore some things might be not clear here
I have 2 separate files: Main.java and Open.java
inside main.java there is a GUI and it has a JTextArea) where i want to show text (variable) called from open.java
in Main.java i have (i took out only important codes, real one is much longer):
//textarea
final JTextArea textarea = new JTextArea();
textarea.setEditable(false);
JScrollPane textScrollPane = new JScrollPane(textarea);
textScrollPane.setPreferredSize(new Dimension(800, 100));
//open function
private void actionPerformedOnOpen(ActionEvent evt, JTextArea textarea) {
javax.swing.JFileChooser chooser = new javax.swing.JFileChooser();
chooser.addChoosableFileFilter(new FileFilter());
int option = chooser.showOpenDialog(this);
if (option == javax.swing.JFileChooser.APPROVE_OPTION) {
String text = new String();
//text = (String)(Open.get(parsedFile));
java.io.File file = chooser.getSelectedFile();
if (file == null) return;
Open readPDBFile = new Open(file.getAbsolutePath());
textarea.append("Opening: " + file.getName());
textarea.setText("Testing..."+text);
}
}
in Open.java i have a variable which contains some text. i want it to be shown inside the textarea in Main.java like textarea.setText("Testing..."+text); and call variable from Open.java instead of text
i looked all over internet, but couldnt find it helpful.
please please please help meee...
Thank you very much ^^