调用一个类中私有或受保护的方法或属性

//重写一个类,重写一个接口
public class QBorderLayout extends BorderLayout{
        //此处定义一个public接口,供外界调用。
      public void setPanelToLayout(Component component){
            //这是一个父类私有受保护的方法(如果是私有,需重写这样的方法)
          onComponentShow(component);
      }
}
业勤于精荒于嬉 http://www.cnblogs.com/maxlei/
原文地址:https://www.cnblogs.com/maxlei/p/5954101.html