I have a little problem.
Class ll:
interface jj{
public class ll implements gg{
public static String j ="C:\\";
//some code here
}
}
Class ggg:
interface gg{
public class ggg extends JFrame implements jj{
//bunch of code + a textfield
textField = new JTextField();
textField.setBounds(72, 120, 217, 20);
textField.setColumns(10);
//bunch of code
}
}
CLass aaa
public class aaa implements jj, gg {
public aaa(){
//File chooser here + editing strin "j" from class "ll"
File f = chooser.getSelectedFile();
if(f!=null)
{
jj.ll.j = f.getPath();
//And printing "j" string to the text field from ggg class
gg.ggg.textField.setText(jj.ll.j);
}
}
}
My problem is, that text field printing doesn’t work. I tryed to System.out.println the jj.ll.j string to test if it has something. and yes it has and works how expected.
I don’t get the logic of making a class inside an interface.
If you need the j string in various classes, just declare it as a public static field in some class. Implementing an interface to get a constant is quite old fashioned. If you use Java 1.5+, do a static import.