Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 编程语言 > Java > gridbaglayout(2)
【标  题】:gridbaglayout(2)
【关键字】:gridbaglayout
【来  源】:http://blog.csdn.net/rmn190/archive/2007/01/16/1484567.aspx

gridbaglayout(2)

Your Ad Here

13,"To specify constraints, you set instance variables in a GridBagConstraints object and tell the

GridBagLayout (with the setConstraints method) to associate the constraints with the component."
  要是放在汉语中,可能不怎么容易理解这句话,理解这里面的instance varialbes和setConstraints!!!
14,Specifying Constraints
  !You must be careful, however, to reset the GridBagConstraints instance variables to their default values

when necessary.
     !!gridx, gridy [the position]
        Specify the row and column at the upper left of the component.(以组件的左上为基点来指定此组件的行列.)
          Valid values: 0,GridBagConstraints.RELATIVE( specify that the component be placed just to the right

of (for gridx) or just below (for gridy) the component that was added to the container just before this

component was added.).
          default value:GridBagConstraints.RELATIVE
     !!gridwidth,gridheight [the number of cells]
       specify the number of columns or rows in the component's display area.(what is the component's display

area?)the number of cells the component uses.(也就是说是里面的那些小格子吧?)
        Valid values:GridBagConstraints.REMAINDER or GridBagConstraints.RELATIVE(specify that the component

be the next to last one in its row (for gridwidth) or column (for gridheight).)
           default value: 1
           NOTE:    GridBagLayout doesn't allow components to span multiple rows unless the component is in

the leftmost column or you've specified positive gridx and gridy values for the component.
     !!fill [larger than]
     used when the component's display area is larger then the component's requested size to determine

whether and how resize the component.
       Valid values(as constants):NONE,HORIZONTAL(make the component wide enough to fill its display area but

dont changes its height),VERTICAL(tall enought),and BOTH(fill its display area entirely)
       default value:NONE.
     !!ipadx,ipady (what's the difference between the two and the above gridwidth???????)
       Specifies the internal padding: how much to add to the minimum size of the component.(The WIDTH of the

component will be at least its minimum width plus ipadx*2 pixels, since the padding applies to both sides of

the component. Similarly, the HEIGHT of the component will be at least its minimum height plus ipady*2

pixels.)
       default value:0
     !!insets(??????????????)
       Specifies the external padding of the component -- the minimum amount of space between the component

and the edges of its display area. The value is specified as an Insets object. By default, each component has

no external padding.
     !!anchor [when the component is smaller than its display area to dertermine...]
       Valid values(as GridBagConstraints constants):CENTER (the default), PAGE_START, PAGE_END, LINE_START,

LINE_END, FIRST_LINE_START, FIRST_LINE_END, LAST_LINE_END, and LAST_LINE_START.
     !!weightx, weighty

?????????????????????????????????????????????????????????????????????????????????????????????????????????????

  When you enlarge GridBagLayoutDemo's window, the columns grow proportionately. This is because each

component in the first row, where each component is one column wide, has weightx = 1.0. The actual value of

these components' weightx is unimportant. What matters is that all the components, and consequently, all the

columns, have an equal weight that is greater than 0. If no component managed by the GridBagLayout had

weightx set, then when the components' container was made wider, the components would stay clumped together

in the center of the container.
   ?why is "all the components ,and consequently,all the columns"???
    

动手写Spring:【上一篇】
JSP工作原理:【下一篇】
【相关文章】
  • Java 中GridBagLayout布局管理器的小例子
  • 【随机文章】
  • windows 2003+windows XP平台下的ADSL共享
  • LSOF 4.74在tru 64上的安装及使用技巧〔原创〕
  • Fedora Core 5 Re-Spin 20060523 Released!
  • 注定郁闷的今天
  • 用C语言编写简单的接口程序<转>
  • 如何在DEBIAN下同时使用postgres7.4和8.0
  • 美白方法怎样美白全身美白全身美白秘方全身美白的方法让漂亮MM看过来
  • 存储过程实例(一)
  • 堆排序(大根堆)
  • 代码的魔术——CSS滤镜之旅
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 bbb软讯网络 All Rigths Reserved.