Apologies if the question is a little ambiguous. Essentially, I have two separate windows. One is the main window which takes in a String of numbers into a JTextField
. I then assign those numbers to a variable (take as a given that all variables are already declared) e.g.
xxxx = textField.getText();
In my second window, which opens up after a button is pushed, I need the number that was entered in the first window's textField to be automatically displayed in a textField in the second window.
for this I use:
textField_1 = new JFormattedTextField();
textField_1.setEditable(false);
panel_4.add(textField_1);
textField_1.setText(dbMain.xxxx);
System.out.println(dbMain.xxxx);
textField_1.setFont(productFont);
textField_1.setColumns(10);
I can't seem to get this to work as everything I have tried just gives me a blank textField or if I try print the variable in the console, I get null
.
dbMain
is the main class in the program from which I'm calling xxxx
from