home *** CD-ROM | disk | FTP | other *** search
- /**********************************************************************
- * FileName: C:\JenAva\Samples\Sound\SoundApp.Java *
- * *
- * Source code generated with JenAva (R) v1.0 *
- **********************************************************************/
- //{{CODECINCH(COMMENT)
- //}}
-
- import java.awt.*;
- import java.applet.Applet;
- import java.awt.image.*;
- import java.applet.AudioClip;
- import java.net.*;
- import java.io.*;
- import java.util.*;
-
- //{{CODECINCH(IMPORT)
- //}}
-
- //{{CODECINCH(BEFORE_ALL)
- //}}
-
- public class SoundApp extends Applet implements ImageObserver
- {
- //{{CODECINCH(BEGIN_APPLET)
- //}}
-
- // ** GUI Objects Declarations
- //{{CODECINCH(BEGIN_FORM_OBJDEC)
- //}}
-
- public static JAFormBack CFBack;
- public static JAButton Button4;
- public static JAButton Button3;
- public static JAButton Button2;
- public static JAButton Button1;
- public static JAStatic Text1;
- public static JAGraphic Graphic1;
-
- //{{CODECINCH(END_FORM_OBJDEC)
- //}}
-
- public static Image Graphic1Image;
-
- public static AudioClip SoundAudio;
-
- public static URL SoundUrl;
-
- public static SoundApp MainForm;
-
-
- public void init()
- {
- //{{CODECINCH(BEGIN_INIT)
- //}}
-
- MainForm = this;
-
- SoundUrl = getDocumentBase();
-
- Graphic1Image = getImage( SoundUrl, "images/Java.gif");
-
- setLayout( new GridLayout(1,1) );
-
- CFBack = new JAFormBack();
- CFBack.setLayout( null );
- CFBack.setBackground( new Color( 192, 192, 192 ) );
- CFBack.setFont( new Font("Helvetica", Font.PLAIN, 12) );
- add( CFBack );
-
- // ** Definitions of all objects for this form
- //{{CODECINCH(BEGIN_FORM_OBJDEF)
- //}}
-
- Button4 = new JAButton(255, 191, 127, 36, "Exit", 1, null, true, false, true, new Color(0, 128, 128) );
- CFBack.add(Button4);
- Button3 = new JAButton(254, 117, 127, 36, "LoopSound", 1, null, true, false, true, new Color(192, 192, 192) );
- CFBack.add(Button3);
- Button2 = new JAButton(253, 72, 127, 36, "StopSound", 1, null, true, false, true, new Color(192, 192, 192) );
- CFBack.add(Button2);
- Button1 = new JAButton(253, 27, 127, 36, "StartSound", 1, null, true, false, true, new Color(192, 192, 192) );
- CFBack.add(Button1);
- Text1 = new JAStatic(53, 12, 179, 49, "TimesRoman", 27, false, false, true, "A Sound Demo", new Color(0, 128, 0), new Color(192, 192, 192), false, new Color(0, 128, 0), true, 1, 4);
- Graphic1 = new JAGraphic(50, 67, 181, 160, 1, SoundApp.Graphic1Image, true, false, true, true);
- CFBack.add(Graphic1);
-
- //{{CODECINCH(END_FORM_OBJDEF)
- //}}
-
-
- resize( 441, 280 );
-
- postEvent( new Event( (Object)this, JAEvent.INITIALIZE, (Object)this ) );
-
- //{{CODECINCH(END_INIT)
- //}}
- }
-
- public void paint( Graphics g )
- {
- //{{CODECINCH(BEGIN_FORM_PAINT)
- //}}
-
- // ** Painting of all objects for this form
-
- if(Button4.bVisible == true)
- Button4.reshape(Button4.xPos, Button4.yPos, Button4.Width, Button4.Height);
- if(Button3.bVisible == true)
- Button3.reshape(Button3.xPos, Button3.yPos, Button3.Width, Button3.Height);
- if(Button2.bVisible == true)
- Button2.reshape(Button2.xPos, Button2.yPos, Button2.Width, Button2.Height);
- if(Button1.bVisible == true)
- Button1.reshape(Button1.xPos, Button1.yPos, Button1.Width, Button1.Height);
- if(Text1.bVisible == true)
- Text1.paint( CFBack.getGraphics() );
- if(Graphic1.bVisible == true)
- Graphic1.reshape(Graphic1.xPos, Graphic1.yPos, Graphic1.Width, Graphic1.Height);
-
- //{{CODECINCH(END_FORM_PAINT)
- //}}
- }
-
- public boolean handleEvent( Event evt )
- {
- //{{CODECINCH(BEGIN_FORM_HANDLEEVENT)
- //}}
-
- if( ( evt.target ).equals( Button4 ) )
- {
- if( evt.id == JAEvent.CLICK )
- {
- JAFunctions.EXIT();
- }
- }
-
- if( ( evt.target ).equals( Button3 ) )
- {
- if( evt.id == JAEvent.CLICK )
- {
- SoundApp.SoundAudio = SoundApp.MainForm.getAudioClip( SoundApp.SoundUrl, "Audio/Music.au" );
-
- JAFunctions.LOOPSOUND(SoundApp.SoundAudio);
- }
- }
-
- if( ( evt.target ).equals( Button2 ) )
- {
- if( evt.id == JAEvent.CLICK )
- {
- if( SoundApp.SoundAudio != null )
- JAFunctions.STOPSOUND(SoundApp.SoundAudio);
- }
- }
-
- if( ( evt.target ).equals( Button1 ) )
- {
- if( evt.id == JAEvent.CLICK )
- {
- SoundApp.SoundAudio = SoundApp.MainForm.getAudioClip( SoundApp.SoundUrl, "Audio/Music.au" );
-
- JAFunctions.STARTSOUND(SoundApp.SoundAudio);
- }
- }
-
- if( ( evt.target ).equals( Graphic1 ) )
- {
- }
-
- if( evt.id == Event.MOUSE_UP )
- {
- Button4.bMouseDown = false;
- Button3.bMouseDown = false;
- Button2.bMouseDown = false;
- Button1.bMouseDown = false;
- }
-
- if( evt.target instanceof JATextField )
- {
- if( evt.id == JAEvent.SELCHANGE )
- evt.id = Event.KEY_PRESS;
- }
-
- if( evt.id == Event.WINDOW_DESTROY )
- {
- postEvent( new Event( (Object)this, JAEvent.CLOSE, (Object)this ) );
- JAFunctions.HIDE( this );
- JAFunctions.EXIT();
-
- return true;
- }
-
- //{{CODECINCH(END_FORM_HANDLEEVENT)
- //}}
-
- return false;
- }
-
- public static void MainFormForm_UpdateTableToLinks()
- {
- }
-
- public static void MainFormForm_UpdateTableFromLinks()
- {
- }
-
- //{{CODECINCH(END_APPLET)
- //}}
- }
-
- //{{CODECINCH(AFTER_ALL)
- //}}
-