Swing method overriding

Hi,

I am trying to compile class A that extends javax.swing.pfaf.basic.BasicComboPopup

I am using java 1.1.8 and Swing1.1.1
I am getting the following error message:

"Method void syncListSelectionWithtComboBoxSelection in class mypackage.A does not override the corresponding method in class javax.swing.pfaf.basic.BasicComboPopup which is private to a different package"

I have a method in class A
protected void syncListSelectionWithComboBoxSelection();
But I did not find any such method in any of the classes in Swing-1.1.1, and neither in java1.2 and 1.3(that have swing library included).

Can you please explain why is the compiler mentioning that when there is no such method in the parent(s), classes of class A.

Thanks
simiAsked:
Who is Participating?
 
sen_kumConnect With a Mentor Commented:

   Look at the source file of javax.swing.pfaf.basic.BasicComboPopup.java file, you can see the funciton
  void syncListSelectionWithtComboBoxSelection() has been declared and it's used only by the class. Since it's access level is package level it will not be shown on swing api documention
0
 
simiAuthor Commented:
Thanks.
0
 
simiAuthor Commented:
Can you also please explain why is it so ?
Package level means that the method will be available to all classes in the package but also to all the subclasses.
If one wants to subclass such a class the subclass will inherit this method. So one could use it or override it.
Should not that clas be shown in the api ?
It looks to me that only private methods do not need to be shown as they will not be available to other classes.

Thanks.
0
 
sen_kumCommented:
if it's package level then its available to all classes in the package but not the subclasses which are not in the same package level.  If the subclasses is with in the same package the method can be overridden
0
 
simiAuthor Commented:
Thanks.
For some reasons I was thinking at protected instead of package.
0
All Courses

From novice to tech pro — start learning today.