Hi I used a static method that I made to invoked a non-static method that the java team made. In the compiling time I receive a compiler error: "ClientProfile.java": Error #: 308 : non-static method remove(java.awt.Component) cannot be referenced from a static context at line 76, column 5 I understand that the invoked �remove() has to be static or move the static declartion from the invoker method. In my case I must the invoker method to be static , since I don�t have control on remove() What should I do?? And second , I declare my class static. Im not sure that im understand the use of static in a class declaration , but though I put static modifier in the class declartion and I receive this error : "ClientProfile.java": Error #: 217 : modifier static not allowed here at line 8, column 15 can you explain a bit about the static vs class relationship? What the rules about the variables that inside a static class?? Thanks in advance
You cant have a static class, unless its an inner class but judging by your error message it isn't. You also can't call a non-static method from a static method, unless you create an instance of the class. This is because the static method is not associated with an instance of the class, while the non-static method is. Try constructing an instance of the class from inside the static method before you call the non-static method. Im not usre if this will suit your needs because I dont know what your cde looks like. Maybe you could post some of the code here.
[This message has been edited by BJ Grau (edited September 15, 2001).]