Buongiorno,
stavo cercando una soluzione per eseguire un metodo al click del mouse.
non ho trovato delle guide decenti e chiedo a voi.
posto il codice
grazie della lettura..codice:import java.awt.Color; import java.awt.FlowLayout; import java.awt.Frame; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class Main extends JPanel { public Main() { setLayout(new FlowLayout(FlowLayout.LEFT,20,20)); add(new JButton("new node")); add(new JButton("new arch")); setBackground(Color.BLACK); } public static void main(String[] args) { JFrame mioframe=new JFrame ("Algoritmo"); mioframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mioframe.setLocation(100,100); mioframe.setSize(250,150); mioframe.setContentPane(new Main()); mioframe.setVisible(true); } }

Rispondi quotando