class BPanel extends JPanel
{
public BPanel()
{
JButton Button = new JButton("Button_");
JTextField Text = new JTextField(15);
add(Button);
add(Text);
ActionListener actionListener = new ColorAction();
Button.addActionListener(actionListener);
}
protected class ColorAction implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
JOptionPane.showMessageDialog(panel, "ppppp"); //ошибка, не видит panel
}
}
}
Button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//Обработка здесь.
}
});