"Voice greetings" applet

Other applets

You can see this applet in work at my sound page. Applet plays voice greetings from .au files according to pushed button.

You can use this applet source and change it free, but You must conserve the lines about the author. Please, send me URL of Your page with applet to E-mail address eremin@hotbot.com.

/* (C) Evgeny Eremin (Perm, Russia) http://pages.hotbot.com/edu/eremin You can use this applet source and change it free, but You must conserve this lines about the author! Add information about Your changes after these lines! Please, send URL of Your page with applet to my E-mail eremin@hotbot.com */ /* This applet plays voice greetings from .au files according to pushed button. */ import java.applet.*; import java.awt.*; public class myHello extends java.applet.Applet{ Button butRussian = new Button("Russian"); AudioClip ru; Button butEnglish = new Button("English"); AudioClip en; //Initialize the applet public void init() { en = getAudioClip(getCodeBase(),"English.au"); ru = getAudioClip(getCodeBase(),"Russian.au"); setLayout(null); setBackground(Color.white); add(butRussian); butRussian.reshape(10,5,60,25); //butRussian.setFont(new Font("Arial Cyr",Font.PLAIN,10)); add(butEnglish); butEnglish.reshape(80,5,60,25); } //Get Applet information public String getAppletInfo() { return "E.A.Eremin: Hello! Applet"; } public void paint(Graphics g){ Dimension d=size(); //applet window size g.drawRect(0,0,d.width-1,d.height-1); g.drawRect(1,1,d.width-3,d.height-3); //window border g.setFont(new Font("Dialog",Font.BOLD,12)); g.drawString("(5 K)",25,50); g.drawString("(7 K)",95,50); showStatus("Voice greetings"); } //Buttons public boolean action(Event e, Object o) { if (e.target instanceof Button) {String s = (String) o; //button name if (s == "English") if (en != null) en.play(); else showStatus("Sound file English.au not found!"); if (s == "Russian") if (ru != null) ru.play(); else showStatus("Sound file Russian.au not found!"); } return(true); } }