Salve ragazzi, ho un piccolo problema: come faccio ad eseguire del codice dopo aver premuto un bottone senza testo ma con l'immagine?
JFrame f = new JFrame();
f.setResizable(false);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(700, 500);
f.setLocationRelativeTo(null); //Finestra al centro dello schermo
f.setLayout(null);
JLabel l1 = new JLabel("Testo da Criptare", Label.RIGHT);
JTextField tte = new JTextField(26);
JLabel l2 = new JLabel("Chiave", Label.RIGHT);
JTextField key1 = new JTextField(26);
key1.setEditable(false);
JLabel l3 = new JLabel("Testo Criptato", Label.RIGHT);
JTextField txte = new JTextField(26);
txte.setEditable(false);
String path1 = "en.png";
ImageIcon icon1 = new ImageIcon(path1);
JButton BE = new JButton(icon1);
f.add(l1); f.add(tte); f.add(l2); f.add(key1); f.add(l3); f.add(txte); f.add(BE);
l1.setBounds(18, 27, 120, 30);
l2.setBounds(258, 27, 120, 30);
l3.setBounds(440, 27, 120, 30);
tte.setBounds(130, 30, 100, 25);
key1.setBounds(303, 30, 100, 25);
txte.setBounds(537, 30, 100, 25);
BE.setBounds(650, 30, 23, 23);
f.setVisible(true);