I'm trying to pass a JTEXTFIELD value I created in class 2 to class 3. My terminal when compiling shows me this:
error: incompatible types
username = class2.username;
My code structure is this.
class 1
- has main
-class2 c2 = new class2
class 2 (extends JFrame)
- JTextField username = new JTextField("", 15);
-method gui here
-method actionlistener here
if e.getsource == submit
class3 c3 = new class3
c3.connection();
class 3
-method connection
-string username declared here
- username = class2.username
How can i get the value from class 2 into class 3?