java for循环错误,以下是一个记事本的菜单代码,但是我运行后发现每个菜单下面只有一个子菜单,求解
super("记事本");JMenuBarmBar=newJMenuBar();JMenu[]mA={newJMenu("文件"),newJMenu("编辑"),newJ...
super("记事本");
JMenuBar mBar=new JMenuBar();
JMenu [] mA={new JMenu("文件"),new JMenu("编辑"),new JMenu("格式"),new JMenu("查看"),new JMenu("帮助")};
char[] [] mC={{'F','E','O','V','H'},
{'N','O','S','X'},
{'U','T','C','P','L','A'},
{'F'},
{'S'},
{'H','A'} };
JMenuItem[][] mI={{new JMenuItem("新建(N)"),new JMenuItem("打开(O)"),new JMenuItem("保存(S)"),new JMenuItem("退出(X)")},
{new JMenuItem("剪切(T)"),new JMenuItem("复制(C)"),new JMenuItem("粘贴(P)"),new JMenuItem("全选(A)"),new JMenuItem("删除(L)")},
{new JMenuItem("字体(F)")},
{new JMenuItem("状态栏(S)")},
{new JMenuItem("帮助(F)"),new JMenuItem("关于记事本(A)")}};
setJMenuBar(mBar);
int i,j;
for(i=0;i<mA.length;i++)
{
mBar.add(mA[i]);
mA[i].setMnemonic(mC[0][i]);
for(j=0;j<mI[i].length-1;j++);
{
mA[i].add(mI[i][j]);
mI[i][j].setMnemonic(mC[i+1][j]);
}
}
谁要是有兴趣或者觉得自己有能力解决可以找我要源代码,我给你们发源代码 展开
JMenuBar mBar=new JMenuBar();
JMenu [] mA={new JMenu("文件"),new JMenu("编辑"),new JMenu("格式"),new JMenu("查看"),new JMenu("帮助")};
char[] [] mC={{'F','E','O','V','H'},
{'N','O','S','X'},
{'U','T','C','P','L','A'},
{'F'},
{'S'},
{'H','A'} };
JMenuItem[][] mI={{new JMenuItem("新建(N)"),new JMenuItem("打开(O)"),new JMenuItem("保存(S)"),new JMenuItem("退出(X)")},
{new JMenuItem("剪切(T)"),new JMenuItem("复制(C)"),new JMenuItem("粘贴(P)"),new JMenuItem("全选(A)"),new JMenuItem("删除(L)")},
{new JMenuItem("字体(F)")},
{new JMenuItem("状态栏(S)")},
{new JMenuItem("帮助(F)"),new JMenuItem("关于记事本(A)")}};
setJMenuBar(mBar);
int i,j;
for(i=0;i<mA.length;i++)
{
mBar.add(mA[i]);
mA[i].setMnemonic(mC[0][i]);
for(j=0;j<mI[i].length-1;j++);
{
mA[i].add(mI[i][j]);
mI[i][j].setMnemonic(mC[i+1][j]);
}
}
谁要是有兴趣或者觉得自己有能力解决可以找我要源代码,我给你们发源代码 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询