【问题标题】:GridLayout. Check the amount of cells used网格布局。检查使用的细胞数量
【发布时间】:2011-03-05 00:26:46
【问题描述】:

使用“GridLayout”创建烤架后:

supper(new GridLayout(rows, column));

我会在每个单元格中添加需求内容:

public void addButton(String name) {
 buttons = new JButton(name);
 add(buttons);
}

据我所知,目前用于保存添加和删除计数器的单元格数量?

谢谢。

【问题讨论】:

    标签: java grid-layout


    【解决方案1】:

    您可以与Container.getComponentCount()联系。

    【讨论】:

    • 总是返回“行 x 列”的结果,而不是那些被使用的结果。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-07
    • 2019-03-01
    • 2014-11-28
    • 1970-01-01
    • 2011-10-28
    • 2013-04-24
    相关资源
    最近更新 更多