Class ImageAndSound
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----java.applet.Applet
|
+----ImageAndSound
- public class ImageAndSound
- extends Applet
- implements ActionListener, AdjustmentListener, ItemListener
User defined class (ImageAndSound) extended from the Applet class to implements musics and images.
Also, the methods of the following interfaces (ActionListener, AdjustmentListener, ItemListener)
are defined in the ImageAndSound class
-
ImageAndSound()
-
-
actionPerformed(ActionEvent)
- Implements the method from the ActionListener Interface
This listerner applies to buttons and actionperfomed is invoked
when the user clicks on the button.
-
adjustmentValueChanged(AdjustmentEvent)
- Implements the method for AdjustmentListener interface
This listener applies to scrollbars and adjustmentvaluechanged
is invoked when the scrollbar is moved.
-
init()
- This method is called after the applet instance is first created by
the browser.
-
is_interrupted()
- Method to determine if the process is interrupted
-
itemStateChanged(ItemEvent)
- Implements the method for ItemListener interface.
-
paint(Graphics)
- This is where user-level drawing is placed.
-
start()
- The start method is called after init is completed, but before the
first invocation of paint.
-
stop()
- The stop method is called everything the user leaves the page
containing the applet or minimizes the browser.
ImageAndSound
public ImageAndSound()
init
public void init()
- This method is called after the applet instance is first created by
the browser. This will initialize the user interface panel for the applet and
display it on the browser
- Overrides:
- init in class Applet
start
public void start()
- The start method is called after init is completed, but before the
first invocation of paint. This method is called everything
the applet is stopped and restarted. Also, it is used
to repaint() the image on different positions
- Overrides:
- start in class Applet
stop
public void stop()
- The stop method is called everything the user leaves the page
containing the applet or minimizes the browser. It is used
as a destructor for the class
- Overrides:
- stop in class Applet
paint
public void paint(Graphics g)
- This is where user-level drawing is placed. It is invoked by the browser
after init and start have completed, and again whenever the browser
needs to be redrawn. Therefore, this method will draw the images at different
location.
- Parameters:
- Graphics - Object
- Overrides:
- paint in class Container
actionPerformed
public void actionPerformed(ActionEvent ae)
- Implements the method from the ActionListener Interface
This listerner applies to buttons and actionperfomed is invoked
when the user clicks on the button.
- Parameters:
- ActionEvent - Object
adjustmentValueChanged
public void adjustmentValueChanged(AdjustmentEvent event)
- Implements the method for AdjustmentListener interface
This listener applies to scrollbars and adjustmentvaluechanged
is invoked when the scrollbar is moved. Therefore, this
method will adjust the pace of the multimedia image
- Parameters:
- AdjustmentEvent - Object
itemStateChanged
public void itemStateChanged(ItemEvent ie)
- Implements the method for ItemListener interface.
This listerner applies to List box and is invoked when an item is
changed. Therefore, this method will capture the
selected song.
- Parameters:
- ItemEvent - Object
is_interrupted
public boolean is_interrupted()
- Method to determine if the process is interrupted