import java.awt.*; import java.awt.event.*; public class ramchandra extends Frame implements ActionListener { public Button b; public TextField tf; public Toolkit tk; public Image img; ramchandra() { setLayout(null); setBackground(Color.gray); setForeground(Color.black); setTitle("Ramchandra Joshi"); tk = getToolkit(); img = tk.getImage("ai.gif"); b = new Button("Exit"); tf = new TextField("Ramchandra"); this.add(b); this.add(tf); b.addActionListener(this); this.setBounds(0,0,800,600); b.setBounds(390,570,50,20); tf.setBounds(40,40,100,20); } public void actionPerformed(ActionEvent e) { if ( e.getSource() == b) { System.out.println( tf.getText() ); System.exit(0); } } public void paint(Graphics g) { g.drawImage(img,100,100,this); } public static void main(String args[]) { ramchandra rj = new ramchandra(); rj.show(); } }