public class JXCInfo {
private JLabel backLabel;
private JDesktopPane desktopPane;
private JFrame frame;
public JXCInfo(){
frame=new JFrame("信息管理部进销存系统");
frame.addComponentListener(new FrameListener());
frame.getContentPane().setLayout(new BorderLayout());
frame.setBounds(100, 100, 800, 600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
backLabel=new JLabel();
backLabel.setVerticalAlignment(SwingConstants.TOP);
backLabel.setHorizontalAlignment(SwingConstants.CENTER);
this.updateBackImage();
desktopPane=new JDesktopPane();
desktopPane.add(backLabel,new Integer(Integer.MIN_VALUE));
frame.getContentPane().add(backLabel);
JTabbedPane navigationPanel=createNavigationPanel();
frame.setVisible(true);

}
}
书上看到的实例代码
请问加红的那句话有什么用,特别是new Integer(Integer.MIN_VALUE)中的Integer.MIN_VALUE,不知道什么意思

解决方案 »

  1.   

    static int MAX_VALUE 
              值为 231-1 的常量,它表示 int 类型能够表示的最大值。 
    static int MIN_VALUE 
              值为 -231 的常量,它表示 int 类型能够表示的最小值。 
      

  2.   

    这个api里写勒,我知道是这个。
    我的意思是在本代码中desktopPane.add(backLabel,new Integer(Integer.MIN_VALUE)); 实现的效果是什么?
      

  3.   

    就是int类型的取值范围的2个边界值。 MAX_VALUE 就是最大值,Integer.MIN_VALUE = 2147483847
      

  4.   

    backLabel是这个desktopPane的背景吧
    desktopPane.add(backLabel,new Integer(Integer.MIN_VALUE)); 
    表示backLabel永远是desktopPane这个容器的最后一个组件,
    也就是说,backLabel永远在desktopPane的最底层
      

  5.   

    4楼的是正解,add(component , int)
    Adds the specified component to this container at the given position. This is a convenience method for addImpl. 
    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.再查看:
    addImpl
    remove
    validate
    javax.swing.JComponent.revalidate()
    参数:
    comp the component to be added
    index the position at which to insert the component, or -1 to append the component to the end
    返回:
    the component comp
    抛出:
    NullPointerException - if comp is null
    IllegalArgumentException - if index is invalid (see addImpl for details)
      

  6.   

    api文档里查啊
    int类型的边界值
      

  7.   

    Inger 占32位二进制位 首位是符号位0表示正数,1表示负数。还剩31位,2的31次方是2147483648 
    所以最小数是-2147483648
      

  8.   

    Integer.MIN_VALUE是最小的负数。应该是2^n-1到-2^n之间