我有一點問題。Java接口實現問題
II級:
interface jj{
public class ll implements gg{
public static String j ="C:\\";
//some code here
}
}
類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
}
}
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);
}
}
}
我的問題是,該文本字段不能打印。我嘗試了System.out.println jj.ll.j字符串來測試它是否有一些東西。是的它的工作方式如何預期。
你確定你需要接口中的類嗎? – stacker 2010-07-21 17:00:41
我的建議是不在接口中嵌入非接口類。 – Powerlord 2010-07-21 17:01:51
我需要在另外3個類中使用j字符串。如果java創建了多繼承特性,那將會容易得多,但我們擁有我們擁有的。 – artouiros 2010-07-21 17:10:11