日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > java >内容正文

java

Java GridBagConstraints的帮助类:GBC

發布時間:2024/4/11 java 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Java GridBagConstraints的帮助类:GBC 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一些API:

  • int gridx, gridy:指定單元格的起始行和列。默認值為 0。
  • int gridwidth, gridheight:指定單元格的行和列的范圍。默認值為 1。
  • double weightx, weighty:指定單元格擴大的容量。默認值為 0。
  • int anchor:表示組件在單元格內的對其方式。可以選擇的絕對位置包括:
NORTHWESTNORTHNORTHEAST
WESTCENTEREAST
SOUTHWESTSOUTHSOUTHEAST

相對位置

FIRST_LINE_STARTLINE_STARTFIRST_LINE_END
PAGE_STARTCENTERPAGE_END
LAST_LINE_STARTLINE_ENDLAST_LINE_END

如果你的應用要本地化為從右向左或者從上向下排列文本,就應該使用后者。默認值為 CENTER。

  • int fill:指定組件在單元格內的填充行為,取值為 NONE、BOTH、HORIZONTAL 或者 VERTICAL。默認值為 NONE。
  • int ipadx, ipady:指定組件周圍的“內部”填充。默認值為 0。
  • Insets insets:指定組件邊框周圍的“外部”填充。默認為不填充。
  • GridBagConstraints(int gridx, int gridy, int gridwidth, int gridheight, double weightx, double weighty, int anchor, int fill, Insets insets, int ipadx, int ipady):用參數中給定的所有字段值構造 GridBagConstraints。這個構造器只用于自動代碼生成器,因為它會讓你的源代碼很難閱讀。
package gridbag;import java.awt.*;/*** This class simplifies the use of the GridBagConstraints class.* @version 1.01 2004-05-06* @author Cay Horstmann*/ public class GBC extends GridBagConstraints {/*** Constructs a GBC with a given gridx and gridy position and all other grid* bag constraint values set to the default.* @param gridx the gridx position* @param gridy the gridy position*/public GBC(int gridx, int gridy){this.gridx = gridx;this.gridy = gridy;}/*** Constructs a GBC with given gridx, gridy, gridwidth, gridheight and all* other grid bag constraint values set to the default.* @param gridx the gridx position* @param gridy the gridy position* @param gridwidth the cell span in x-direction* @param gridheight the cell span in y-direction*/public GBC(int gridx, int gridy, int gridwidth, int gridheight){this.gridx = gridx;this.gridy = gridy;this.gridwidth = gridwidth;this.gridheight = gridheight;}/*** Sets the anchor.* @param anchor the anchor value* @return this object for further modification*/public GBC setAnchor(int anchor){this.anchor = anchor;return this;}/*** Sets the fill direction.* @param fill the fill direction* @return this object for further modification*/public GBC setFill(int fill){this.fill = fill;return this;}/*** Sets the cell weights.* @param weightx the cell weight in x-direction* @param weighty the cell weight in y-direction* @return this object for further modification*/public GBC setWeight(double weightx, double weighty){this.weightx = weightx;this.weighty = weighty;return this;}/*** Sets the insets of this cell.* @param distance the spacing to use in all directions* @return this object for further modification*/public GBC setInsets(int distance){this.insets = new Insets(distance, distance, distance, distance);return this;}/*** Sets the insets of this cell.* @param top the spacing to use on top* @param left the spacing to use to the left* @param bottom the spacing to use on the bottom* @param right the spacing to use to the right* @return this object for further modification*/public GBC setInsets(int top, int left, int bottom, int right){this.insets = new Insets(top, left, bottom, right);return this;}/*** Sets the internal padding* @param ipadx the internal padding in x-direction* @param ipady the internal padding in y-direction* @return this object for further modification*/public GBC setIpad(int ipadx, int ipady){this.ipadx = ipadx;this.ipady = ipady;return this;} }

總結

以上是生活随笔為你收集整理的Java GridBagConstraints的帮助类:GBC的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。