我查手册和源码,还是无法找到这个函数原型

解决方案 »

  1.   

    public void add(Component comp,
                    Object constraints)
    应该是这个方法吧...
      

  2.   

    JPanel查不到..  向上回溯..  查找父类..找不到再向上..总能找到的.
      

  3.   

    public void add(Component comp,
                    Object constraints)Adds the specified component to the end of this container. Also notifies the layout manager to add the component to this container's layout using the specified constraints object. This is a convenience method for addImpl(java.awt.Component, java.lang.Object, int). 
    Note: If a component has been added to a container that has been displayed, validate must be called on that container to display the new component. If multiple components are being added, you can improve efficiency by calling validate only once, after all the components have been added. 
    Parameters:
    comp - the component to be added
    constraints - an object expressing layout contraints for this component 
    Throws: 
    NullPointerException - if comp is null
      

  4.   

    public void add(Component comp,Object constraints)
       Adds the specified component to the end of this container. Also notifies the layout manager to add the component to this container's layout using the specified constraints object. This is a convenience method for addImpl(java.awt.Component, java.lang.Object, int). 
    Note: If a component has been added to a container that has been displayed, validate must be called on that container to display the new component. If multiple components are being added, you can improve efficiency by calling validate only once, after all the components have been added. 
    Parameters:
    comp - the component to be added
    constraints - an object expressing layout contraints for this component 
    Throws: 
    NullPointerException - if comp is null
      

  5.   

    它超类 java.awt.Container 有,如下
    public void add(Component comp, Object constraints) {...}
    其中 JButton 间接继承自 Component,String 更不用说了。
      

  6.   

    这个原型,我是找到了,但是怀疑它不是。
    为什么不能直接是:
    public void add(Component comp, String name) {...}
      

  7.   

    public void add(Component comp, Object constraints) {...}
      

  8.   

    public void add(Component comp, Object constraints) {...}
      

  9.   

    为什么一定要直接是public void add(Component comp, String name) {...}呢?