Page 219 - CITS - CSA - TP (Volume 2) - Hindi
P. 219

कं  ूटर सॉ वेयर ए ीके शन - CITS



           आउटपुट :









































           टा  2: ए न िल र के  साथ बटन चयन
           import javax.swing.*;

           import java.awt.event.ActionEvent;

           import java.awt.event.ActionListener;



           public class ButtonClickExample {



               public static void main(String[] args) {

                   JFrame frame = new JFrame(“Button Click Example”);

                   JButton button = new JButton(“Click me”);



                   button.addActionListener(new ActionListener() {

                       @Override

                       public void actionPerformed(ActionEvent e) {

                           JOptionPane.showMessageDialog(null, “Button clicked!”);
                       }

                   });


                                                           205

                                  CITS : IT & ITES - कं  ूटर सॉ वेयर ए ीके शन - अ ास 118
   214   215   216   217   218   219   220   221   222   223   224