home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-09-09 | 5.7 KB | 192 lines |
- /*
- A basic extension of the java.awt.Frame class
- */
-
- import java.awt.*;
-
- import symantec.itools.multimedia.*;
- import symantec.itools.util.Timer;
- import symantec.itools.awt.*;
- public class SoundPlayerClass extends Frame
- {
- public SoundPlayerClass()
- {
- // This code is automatically generated by Visual Cafe when you add
- // components to the visual environment. It instantiates and initializes
- // the components. To modify the code, only use code syntax that matches
- // what Visual Cafe can generate, or Visual Cafe may be unable to back
- // parse your Java file into its visual environment.
- //{{INIT_CONTROLS
- setLayout(null);
- setVisible(false);
- setSize(insets().left + insets().right + 430,insets().top + insets().bottom + 270);
- setBackground(new Color(12632256));
- soundPlayer1 = new symantec.itools.multimedia.SoundPlayer();
- try {
- java.net.URL[] tempURL = new java.net.URL[5];
- tempURL[0] = symantec.itools.net.RelativeURL.getURL("sounds/T1.AU");
- tempURL[1] = symantec.itools.net.RelativeURL.getURL("sounds/T2.AU");
- tempURL[2] = symantec.itools.net.RelativeURL.getURL("sounds/T3.AU");
- tempURL[3] = symantec.itools.net.RelativeURL.getURL("sounds/T4.AU");
- tempURL[4] = symantec.itools.net.RelativeURL.getURL("sounds/T5.AU");
- soundPlayer1.setURLList(tempURL);
- }
- catch (java.net.MalformedURLException error) { }
- catch(java.beans.PropertyVetoException e) { }
- //$$ soundPlayer1.move(212,61);
- imageViewer1 = new symantec.itools.multimedia.ImageViewer();
- try {
- imageViewer1.setURL(new java.net.URL("file:///C:/WINDOWS/DESKTOP/FINALLY/images/right.gif"));
- }
- catch (java.net.MalformedURLException error) { }
- catch(java.beans.PropertyVetoException e) { }
- imageViewer1.setBounds(insets().left + 42,insets().top + 7,136,131);
- add(imageViewer1);
- imageViewer2 = new symantec.itools.multimedia.ImageViewer();
- try {
- imageViewer2.setURL(new java.net.URL("file:///C:/WINDOWS/DESKTOP/FINALLY/images/right.gif"));
- }
- catch (java.net.MalformedURLException error) { }
- catch(java.beans.PropertyVetoException e) { }
- imageViewer2.setBounds(insets().left + 251,insets().top + 7,136,131);
- add(imageViewer2);
- imageButton1 = new symantec.itools.awt.ImageButton();
- try {
- imageButton1.setImageURL(new java.net.URL("file:///C:/WINDOWS/DESKTOP/FINALLY/images/stop.gif"));
- }
- catch (java.net.MalformedURLException error) { }
- catch(java.beans.PropertyVetoException e) { }
- imageButton1.setBounds(insets().left + 136,insets().top + 145,57,58);
- add(imageButton1);
- imageButton2 = new symantec.itools.awt.ImageButton();
- try {
- imageButton2.setImageURL(new java.net.URL("file:///C:/WINDOWS/DESKTOP/FINALLY/images/play.gif"));
- }
- catch (java.net.MalformedURLException error) { }
- catch(java.beans.PropertyVetoException e) { }
- imageButton2.setBounds(insets().left + 240,insets().top + 145,57,58);
- add(imageButton2);
- setTitle("Untitled");
- //}}
-
- //{{INIT_MENUS
- //}}
-
- //{{REGISTER_LISTENERS
- SymWindow aSymWindow = new SymWindow();
- this.addWindowListener(aSymWindow);
- SymComponent aSymComponent = new SymComponent();
- SymAction lSymAction = new SymAction();
- imageButton1.addActionListener(lSymAction);
- imageButton2.addActionListener(lSymAction);
- //}}
- }
-
- public SoundPlayerClass(String title)
- {
- this();
- setTitle(title);
- }
-
- public synchronized void show()
- {
- move(50, 50);
- super.show();
- }
-
- public void addNotify()
- {
- // Record the size of the window prior to calling parents addNotify.
- Dimension d = getSize();
-
- super.addNotify();
-
- if (fComponentsAdjusted)
- return;
-
- // Adjust components according to the insets
- setSize(insets().left + insets().right + d.width, insets().top + insets().bottom + d.height);
- Component components[] = getComponents();
- for (int i = 0; i < components.length; i++)
- {
- Point p = components[i].getLocation();
- p.translate(insets().left, insets().top);
- components[i].setLocation(p);
- }
- fComponentsAdjusted = true;
- }
-
- // Used for addNotify check.
- boolean fComponentsAdjusted = false;
-
- //{{DECLARE_CONTROLS
- symantec.itools.multimedia.SoundPlayer soundPlayer1;
- symantec.itools.multimedia.ImageViewer imageViewer1;
- symantec.itools.multimedia.ImageViewer imageViewer2;
- symantec.itools.awt.ImageButton imageButton1;
- symantec.itools.awt.ImageButton imageButton2;
- //}}
-
- //{{DECLARE_MENUS
- //}}
-
- class SymWindow extends java.awt.event.WindowAdapter
- {
- public void windowClosing(java.awt.event.WindowEvent event)
- {
- Object object = event.getSource();
- if (object == SoundPlayerClass.this)
- Frame1_WindowClosing(event);
- }
- }
-
- void Frame1_WindowClosing(java.awt.event.WindowEvent event)
- {
- hide(); // hide the Frame
- }
-
- class SymComponent extends java.awt.event.ComponentAdapter
- {
- public void componentHidden(java.awt.event.ComponentEvent event)
- {
- Object object = event.getSource();
- }
- }
-
- class SymAction implements java.awt.event.ActionListener
- {
- public void actionPerformed(java.awt.event.ActionEvent event)
- {
- Object object = event.getSource();
- if (object == imageButton1)
- imageButton1_actionPerformed(event);
- else if (object == imageButton2)
- imageButton2_actionPerformed(event);
- }
- }
-
- void imageButton1_actionPerformed(java.awt.event.ActionEvent event)
- {
- // to do: code goes here.
-
- //{{CONNECTION
- // Stop the sound player
- {
- soundPlayer1.stop();
- }
- //}}
- }
-
- void imageButton2_actionPerformed(java.awt.event.ActionEvent event)
- {
- // to do: code goes here.
-
- //{{CONNECTION
- // Start the sound player
- {
- soundPlayer1.play();
- }
- //}}
- }
- }
-