//PROGRAM 13-2 import java.awt.*; import java.awt.event.*; import javax.swing.*; public class DemoAppletSwing extends JApplet implements ActionListener { public JTextField textField; public JButton button; public void init() { // mendapatkan container Container cont = getContentPane(); cont.setLayout(new FlowLayout()); // menambahkan komponen JTextField textField = new JTextField(25); cont.add(textField, BorderLayout.CENTER); // menambahkan komponen JButton button = new JButton("Tombol Applet"); button.addActionListener(this); cont.add(button, BorderLayout.CENTER); } // menangani event klik pada komponen JButton public void actionPerformed(ActionEvent event) { if (event.getSource() == button) { textField.setText("Anda telah melakukan klik " + "pada tombol Applet"); } } }