i'm a junior java programmer, and i get a programming problem occur in compile time, the program has two file call fatherFrame.java and sonFrame, these file as follow: /* fatherFrame.java */ import javax.swing.*;
public class fatherFrame { JFrame f = new JFrame("father");
f.show(); } public static void main(String[] args) { fatherFrame runMain = new fatherFrame(); } }
/* sonFrame.java */ import javax.swing.*;
public class sonFrame { sonFrame() {
JInternalFrame cf = new JInternalFrame("son",false,true,false,true); cf.setSize(300,300);
cf.show(); } }
error message: fatherFrame.java:11: cannot resolve symbol symbol : method add (sonFrame) location: class java.awt.Container f.getContentPane().add(cf); ^ my java compile is 1.4 and how to solve this problem? thank you
add method of java.awt.Container requires argument of type Component . If your sonFrame class extends java.awt.Component the compilation problem should be solved.