将数组添加到面板 [英] Adding an Array to panel

查看:93
本文介绍了将数组添加到面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

for (int count = 0; count = 26; count ++)
         {
              letter[count] += Alpha.charAt(count);
              arrBtnAlpha[count] = new JButton(letter[count]);
              pan1.add(arrBtnAlpha[count]);
         }



我想添加26个带有字母的按钮,但是我希望第一和第二行具有9个字母,其余的一个字母位于第三行.我已经尝试过pan1.setLayout(new GridLayout(9, 4));,它只填满整个屏幕,而我想将容器分为3:面板1,面板2和面板3.



I want to add 26 buttons with letters of the alphabet but I want the first and second rows to have 9 letters and the remaining one letter to be on the 3rd row. I have already tried pan1.setLayout(new GridLayout(9, 4)); and it just fills the whole screen while I want to divide the container in to 3: panel 1, panel 2 and panel 3.

推荐答案

此处查看示例 [
Take a look at the sample here[^], it should help to resolve your problem.


这篇关于将数组添加到面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆