⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e623. setting the location of a component in a gridbaglayout.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
 gridbag layout arranges components in a two-dimensional grid of cells. The northwest-most cell has position (0,0). The cell to the right or east has position (1,0); the cell to the bottom or south has position (0,1). 
The size of the grid grows dynamically. For example, if you place a component at position (2,1) in a new empty gridbag layout, the layout will automatically have a size of 3 cells across by 2 cells down. 

See e622 Creating a GridBagLayout for an example on how to use a gridbag layout with gridbag constraints. 

    GridBagConstraints gbc = new GridBagConstraints();
    
    // Place a component at (1,1)
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbl.setConstraints(component1, gbc);
    container.add(component1);
    // The layout now has 4 cells
    
    // Place a component at (0,0)
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbl.setConstraints(component2, gbc);
    container.add(component2);

⌨️ 快捷键说明

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