e627. setting the stretchyness of columns and rows in a gridbaglayout using component weights.txt

来自「这里面包含了一百多个JAVA源文件」· 文本 代码 · 共 17 行

TXT
17
字号
See e626 Setting the Stretchyness of Rows and Columns in a GridBagLayout Using Layout Weights for an explanation of stretchyness and weights. This example demonstrates how to set the weight of a row or column by assigning the weight on a component. 
See e622 Creating a GridBagLayout for an example on how to use a gridbag layout with gridbag constraints. 

    GridBagLayout gbl = new GridBagLayout();
    container.setLayout(gbl);
    
    // Place a component at (0,1) with a column weight 1 and
    // a row weight of 2
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.weightx = 1;
    gbc.weighty = 2;
    gbl.setConstraints(component, gbc);
    container.add(component);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?