中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

重慶網(wǎng)站制作那家好愛(ài)站小工具

重慶網(wǎng)站制作那家好,愛(ài)站小工具,中國(guó)住房和城鄉(xiāng)建設(shè)部網(wǎng)站建造師,順企網(wǎng)我做網(wǎng)站GridBagLayout以表格形式布置容器內(nèi)的組件, 將每個(gè)組件放置在每個(gè)單元格內(nèi),而一個(gè)單元格可以跨越多個(gè)單元格合并成一個(gè)單元格,即多個(gè)單元格可以組合成一個(gè)單元格,從而實(shí)現(xiàn)組件的自由布局。每一個(gè)單元格都有各自的屬性,…
  1. GridBagLayout以表格形式布置容器內(nèi)的組件, 將每個(gè)組件放置在每個(gè)單元格內(nèi),而一個(gè)單元格可以跨越多個(gè)單元格合并成一個(gè)單元格,即多個(gè)單元格可以組合成一個(gè)單元格,從而實(shí)現(xiàn)組件的自由布局。
  2. 每一個(gè)單元格都有各自的屬性,而這些屬性由GridBagConstrainsts類(lèi)的成員變量來(lái)定義,且GridBagConstriaints中的所有成員變量都是public的。
  3. 構(gòu)造函數(shù):
    GirdBagLayout()建立一個(gè)新的GridBagLayout管理器。
    GridBagConstraints()建立一個(gè)新的GridBagConstraints對(duì)象。
    GridBagConstraints(int gridx,int gridy,int gridwidth,int gridheight,double weightx,double weighty,int anchor,int fill, Insets insets,int ipadx,int ipady)
    建立一個(gè)新的GridBagConstraints對(duì)象,并指定其參數(shù)的值。
  4. 下面提供一個(gè)用來(lái)設(shè)置GridBagConstraints對(duì)象各參數(shù)的幫助類(lèi)
import java.awt.GridBagConstraints;
import java.awt.Insets;
/**1. 2. @author han3.         功能:用來(lái)設(shè)置GridBagConstraints對(duì)象的一些參數(shù)4. */
public class GBC extends GridBagConstraints {/*** 初始化左上角位置 gridx,gridy —— 設(shè)置組件的位置,* gridx=0,gridy=0時(shí)放在0行0列。* * @param gridx* @param gridy*/public GBC(int gridx, int gridy) {this.gridx = gridx;this.gridy = gridy;}/*** 初始化左上角位置和所占行數(shù)和列數(shù)* * gridwidth,gridheight —— 用來(lái)設(shè)置組件所占的單位長(zhǎng)度與高度,默認(rèn)值皆為1。* 可以使用GridBagConstraints.REMAINDER常量,* 代表此組件為此行或此列的最后一個(gè) 組件,而且會(huì)占據(jù)所有剩余的空間。* * @param gridx* @param gridy* @param gridwidth* @param gridheight*/public GBC(int gridx, int gridy, int gridwidth, int gridheight) {this.gridx = gridx;this.gridy = gridy;this.gridwidth = gridwidth;this.gridheight = gridheight;}/*** 對(duì)齊方式 anchor:設(shè)置組件在單元格中的對(duì)齊方式。* 由以下常量來(lái)定義* * GridBagConstraints.CENTER* * GridBagConstraints.EAST* * GridBagConstraints.WEST* * GridBagConstraints.SOUTH* * GridBagConstraints.NORTH* * GridBagConstraints.SOUTHEAST* * GrisBagConstraints.SOUTHWEST* * GridBagConstraints.NORTHEAST* * GridBagConstraints.NORTHWEST* * @param anchor* @return*/public GBC setAnchor(int anchor) {this.anchor = anchor;return this;}/*** 是否拉伸及拉伸方向* * fill:當(dāng)某個(gè)組件未能填滿(mǎn)單元格時(shí),可由此屬性設(shè)置橫向、* 縱向或雙向填滿(mǎn)。由以下常量來(lái)定義* * GridBagConstraints.NONE* * GridBagConstraints.HORIZONTAL* * GridBagConstraints.VERTICAL* * GridBagConstraints.BOTH* * @param fill* @return*/public GBC setFill(int fill) {this.fill = fill;return this;}/*** x和y方向上的增量* * weightx,weighty——用來(lái)設(shè)置窗口變大時(shí),各組件跟著變大的比例。 * 當(dāng)數(shù)字越大,表示組件能得到更多的空間,默認(rèn)值皆為0(0-1)。* * @param weightx* @param weighty* @return*/public GBC setWeight(double weightx, double weighty) {this.weightx = weightx;this.weighty = weighty;return this;}/*** 外部填充* * @param distance* @return*/public GBC setInsets(int distance) {this.insets = new Insets(distance, distance, distance, distance);return this;}/*** 外填充* * insets —— 設(shè)置組件之間彼此的間距。* 它有四個(gè)參數(shù),分別是上,左,下,右,默認(rèn)為(0,0,0,0)。* * @param top* @param left* @param bottom* @param right* @return*/public GBC setInsets(int top, int left, int bottom, int right) {this.insets = new Insets(top, left, bottom, right);return this;}/*** 內(nèi)填充* * ipadx,ipady —— 設(shè)置組件間距,默認(rèn)值為0。* * @param ipadx* @param ipady* @return*/public GBC setIpad(int ipadx, int ipady) {this.ipadx = ipadx;this.ipady = ipady;return this;}
}
  1. GridBagLayout布局的一個(gè)案例—->使三個(gè)帶顏色的面板一直在Frame窗口的中央顯示(無(wú)論窗口放大還是縮小)
import java.awt.Color;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.GridBagLayout;
/*** * @author han* * 使用GridBagLayout布局的一個(gè)案例* * 功能:使三個(gè)帶顏色的面板一直在Frame窗口的中央顯示(無(wú)論窗口放大還是縮小)* */
public class GridBagLayoutTest extends JFrame {private static final long serialVersionUID = 1391949900949468015L;private JPanel contentPane;public static void main(String[] args) {EventQueue.invokeLater(new Runnable() {public void run() {try {GridBagLayoutTest frame = new GridBagLayoutTest();frame.setVisible(true);} catch (Exception e) {e.printStackTrace();}}});}public GridBagLayoutTest() {setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setBounds(100, 100, 511, 500);setTitle("GridBagLayout布局案例");contentPane = new JPanel();setContentPane(contentPane);GridBagLayout gbl_contentPane = new GridBagLayout();contentPane.setLayout(gbl_contentPane);JPanel jPanel1 = new JPanel();jPanel1.setSize(300, 100);jPanel1.setBackground(Color.blue);JPanel jPanel2 = new JPanel();jPanel2.setSize(300, 300);jPanel2.setBackground(Color.red);JPanel jPanel3 = new JPanel();jPanel3.setSize(300, 100);jPanel3.setBackground(Color.YELLOW);//如果加入的是空的面板時(shí)需要把內(nèi)部填充的大小與面板size的大小設(shè)為一樣。contentPane.add(jPanel1, new GBC(0, 1).setInsets(20, 0, 20, 0).setWeight(1, 0).setIpad(300, 100));contentPane.add(jPanel2, new GBC(0, 2).setInsets(20, 0, 20, 0).setWeight(1, 0).setIpad(300, 100));contentPane.add(jPanel3, new GBC(0, 3).setInsets(20, 0, 20, 0).setWeight(1, 0).setIpad(300, 100));}}
http://www.risenshineclean.com/news/32704.html

相關(guān)文章:

  • 2023年電腦端網(wǎng)游濟(jì)南百度推廣優(yōu)化
  • 西安哪里做網(wǎng)站最大鄭州seo顧問(wèn)
  • 國(guó)內(nèi)做批發(fā)的網(wǎng)站百度醫(yī)生在線(xiàn)問(wèn)診
  • 網(wǎng)站集約化建設(shè)紀(jì)要網(wǎng)站案例分析
  • wordpress關(guān)注微信登陸廈門(mén)seo總部電話(huà)
  • 開(kāi)發(fā)網(wǎng)站的步驟百度電腦版下載官網(wǎng)
  • 柳州做網(wǎng)站有kv網(wǎng)絡(luò)營(yíng)銷(xiāo)八大職能
  • 網(wǎng)站不備案可以做淘寶客嗎營(yíng)銷(xiāo)推廣公司案例
  • 網(wǎng)站設(shè)計(jì)精美案例電腦培訓(xùn)學(xué)校哪家好
  • 修改wordpress版權(quán)搜索引擎優(yōu)化是指
  • 建企業(yè)網(wǎng)站哪家好百度云搜索引擎入口
  • 邢臺(tái)企業(yè)做網(wǎng)站搜索關(guān)鍵詞的網(wǎng)站
  • 網(wǎng)站建設(shè)困難嗎企業(yè)宣傳推廣方案
  • wordpress 滑塊驗(yàn)證碼搜索引擎優(yōu)化教材答案
  • wordpress在服務(wù)器上安裝插件上海谷歌seo推廣公司
  • 企業(yè)營(yíng)銷(xiāo)型網(wǎng)站建設(shè)優(yōu)惠成人教育培訓(xùn)機(jī)構(gòu)
  • html5手機(jī)網(wǎng)站發(fā)布阿里云注冊(cè)域名
  • 運(yùn)濤網(wǎng)站建設(shè)南昌網(wǎng)站seo外包服務(wù)
  • 在什么網(wǎng)站做推廣最好鞍山seo公司
  • 哪個(gè)網(wǎng)站域名便宜seo報(bào)名在線(xiàn)咨詢(xún)
  • wordpress調(diào)用指定文章內(nèi)容seo優(yōu)化網(wǎng)站推廣全域營(yíng)銷(xiāo)獲客公司
  • 網(wǎng)站建設(shè)書(shū)本信息網(wǎng)站搜索引擎優(yōu)化的步驟
  • 北京網(wǎng)站設(shè)計(jì)方案優(yōu)化品牌seo關(guān)鍵詞
  • 服裝小訂單接單平臺(tái)seo網(wǎng)站優(yōu)化推廣費(fèi)用
  • 網(wǎng)站游戲制作開(kāi)發(fā)神秘網(wǎng)站
  • 建什么網(wǎng)站能百度收錄國(guó)際國(guó)內(nèi)新聞最新消息今天
  • 免費(fèi)php企業(yè)網(wǎng)站源碼關(guān)鍵詞優(yōu)化怎么做
  • 理財(cái)平臺(tái)網(wǎng)站建設(shè)交換鏈接營(yíng)銷(xiāo)成功案例
  • 互聯(lián)網(wǎng)行業(yè)信息網(wǎng)站免費(fèi)b2b網(wǎng)站推廣渠道
  • wordpress圖片燈箱效果修改百度seo營(yíng)銷(xiāo)推廣