+ 2

How i can program a button to do some thing when i click on it in java .

button

22nd May 2018, 9:15 AM
Mustapha Farhan
Mustapha Farhan - avatar
5 odpowiedzi
+ 2
See here https://docs.oracle.com/javase/tutorial/uiswing/events/actionlistener.html Bookmarks this site for learn futhermore 😉
22nd May 2018, 10:58 PM
KrOW
KrOW - avatar
+ 2
Depends on framework that you are using... In swing you have to add an action listener to button and implement actionPerformed method: myButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent event){ // your code here } });
22nd May 2018, 9:29 AM
KrOW
KrOW - avatar
+ 1
thanx
22nd May 2018, 11:18 PM
Mustapha Farhan
Mustapha Farhan - avatar
+ 1
👍👍👍
22nd May 2018, 11:19 PM
KrOW
KrOW - avatar
0
so thank u i understand but a little if you can specify the types of (action listener )or show me where i can find information about it .
22nd May 2018, 9:02 PM
Mustapha Farhan
Mustapha Farhan - avatar