import java.awt.*; import java.applet.*; import java.awt.event.*; public class ap extends Applet implements ActionListener { Button gomb1; String s; public void init() { setLayout(null); // Ez után használhatjuk a setBounds metódust. gomb1 = new Button("Valami"); gomb1.setBounds(20,20,100,30); gomb1.addActionListener(this); add(gomb1); } public void actionPerformed (ActionEvent e){ if(e.getSource() == gomb1) s = "alma"; repaint(); } public void paint (Graphics g) { g.drawString("Eredmény: " + s, 50, 80); } }