[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Mixing and making instances of classes in applets

Posted on 2005-04-21
9
Medium Priority
?
222 Views
Last Modified: 2010-03-31
I need some help or tutorial on the way the main class interacts with all the other classes and the methods called within them. I used to have a basic understanding of it, but i'm getting lost trying to run before i can walk i fear.


When building an applet does all the code have to be within the one file? or can new classes be created and linked to from the main class. If so should the main class be on its own, just calling other methods in the new classes

Does anyone know effective tutorials?? (even better any tutorials that show basic practices and manipulating a clip file together)
0
Comment
Question by:pigmentarts
  • 5
  • 2
  • 2
9 Comments
 
LVL 15

Expert Comment

by:aozarov
ID: 13837478
0
 
LVL 15

Expert Comment

by:aozarov
ID: 13837495
For sound clip info: http://java.sun.com/docs/books/tutorial/sound/playing.html (has an Applet example)
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 92

Assisted Solution

by:objects
objects earned 600 total points
ID: 13838623
> When building an applet does all the code have to be within the one file?

no

> or can new classes be created and linked to from the main class.
> If so should the main class be on its own, just calling other methods in the new classes

Applets don't have a main, instead your 'main' class needs to be a subclass of Applet (of JApplet) for Swing.
That class can use as many other classes as it requires.

0
 
LVL 92

Expert Comment

by:objects
ID: 13838644
0
 
LVL 12

Author Comment

by:pigmentarts
ID: 13844596
last question.

For playing 3 different sounds at 3 different Volume levels. What should my classes be.

And how many will i need
0
 
LVL 15

Accepted Solution

by:
aozarov earned 1000 total points
ID: 13845186
see javadoc for: http://java.sun.com/j2se/1.5.0/docs/api/java/applet/AudioClip.html
Your Applet can call 3 times to

AudioClip clip1 = getAudioClip(url1);
AudioClip clip2 = getAudioClip(url2);
AudioClip clip3 = getAudioClip(url3);
and then do: clip1.play(); clip2.play(); clip3.play();

I don't think you can control the volume level using this simple technique (AudioClip).
For that you will need to use java sound API (part of the JDK since 1.4)
see http://www.onjava.com/lpt/a/4684 for example.
0
 
LVL 12

Author Comment

by:pigmentarts
ID: 13846949
> see javadoc for: http://java.sun.com/j2se/1.5.0/docs/api/java/applet/AudioClip.html

the link says AudioClip plays the audio clips all together, I need them to play separately. Or am i misunderstanding :D
0
 
LVL 15

Expert Comment

by:aozarov
ID: 13847126
Eeach AudioClip can play its clip when its play method get called. you can call them seperatly or together, both should work.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses
Course of the Month19 days, 13 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question