У меня есть этот код:
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == ItemEvent.SELECTED)
{
int x = comboBox.getSelectedIndex();
if(x >=0 && x<=6)
{
JButton button[] = new JButton[31];
for(int i = 0; i < 31; i++)
{
button[i] = new JButton(String.valueOf(i + 1));
button[i].addActionListener(this);
add(button[i]);
}
}
public void actionPerformed(ActionEvent e) {
}
Но button[i].addactionlistener(this)
выдает мне эту ошибку:
addActionListener(java.awt.event.ActionListener) in javax.swing.AbstractButton
cannot be applied to (<anonymous java.awt.event.ItemListener>)
Как мне решить эту проблему?
I think this refer to jcombobox