数時間前にこの質問をしましたが、自分自身をうまく説明できなかったと思います。これが私のコードです:
for (a = 1; a < 14; a++) {
JMenuItem "jmenu"+a = new JMenuItem(String.valueOf(a));
"jmenu"+a.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
rrr[a] = a;
texto.setFont(texto.getFont().deriveFont((float) a));
current = a;
}
});
tamano.add("jmenu"+a);
}
私がする必要があるのはJMenuItem
、これらの名前でいくつかのを作成することです。
jmenu1
jmenu2
jmenu3
jmenu4
etc...
- -編集 - -
私が欲しいのは、それぞれJMenuitem
が異なる名前を持っているということです:
JMenuItem "jmenu"+a //with this I can't create the JMenuItem; it's not permitted
= new JMenuItem(); //I dont care about this