请问这句话中的Integer.MIN_VALUE是什么意思?

xiaoyanglei 2009-03-21 03:54:49
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,不知道什么意思
...全文
10668 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
郑宏辉 2010-11-24
  • 打赏
  • 举报
回复
Integer.MIN_VALUE是最小的负数。应该是2^n-1到-2^n之间
long9299 2009-03-22
  • 打赏
  • 举报
回复
api文档里查啊
int类型的边界值
__浮夸 2009-03-22
  • 打赏
  • 举报
回复
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)
台城柳月 2009-03-22
  • 打赏
  • 举报
回复
backLabel是这个desktopPane的背景吧
desktopPane.add(backLabel,new Integer(Integer.MIN_VALUE));
表示backLabel永远是desktopPane这个容器的最后一个组件,
也就是说,backLabel永远在desktopPane的最底层
yuxiaokill 2009-03-22
  • 打赏
  • 举报
回复
就是int类型的取值范围的2个边界值。 MAX_VALUE 就是最大值,Integer.MIN_VALUE = 2147483847
suncheng_hong 2009-03-22
  • 打赏
  • 举报
回复
Inger 占32位二进制位 首位是符号位0表示正数,1表示负数。还剩31位,2的31次方是2147483648
所以最小数是-2147483648
xiaoyanglei 2009-03-21
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 wafj1984 的回复:]
static int MAX_VALUE
值为 231-1 的常量,它表示 int 类型能够表示的最大值。
static int MIN_VALUE
值为 -231 的常量,它表示 int 类型能够表示的最小值。
[/Quote]
这个api里写勒,我知道是这个。
我的意思是在本代码中desktopPane.add(backLabel,new Integer(Integer.MIN_VALUE)); 实现的效果是什么?
wafj1984 2009-03-21
  • 打赏
  • 举报
回复
static int MAX_VALUE
值为 231-1 的常量,它表示 int 类型能够表示的最大值。
static int MIN_VALUE
值为 -231 的常量,它表示 int 类型能够表示的最小值。

62,633

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧