|
-
Mar 21st, 2001, 07:09 PM
#1
Thread Starter
Hyperactive Member
Weee! I finally have java compiler working home too (thanks VirtuallyVB and Dilenger4), now just would like to know a few simple (?) things:
1) How can you play a sound in Java?
2) How can you paint from a jpg or gif file?
3) How con you make a link to another file (like if you click a button, a download is initiated)?
-JR-
"Blessed are we who can laugh at ourselves for we shall never cease to be amused"
- Unknown
-
Mar 22nd, 2001, 04:38 PM
#2
Hyperactive Member
Hmmm
Well you really need to be more specific here, for are you going to building an applet or an application? They have different methods to play and load images, so you will need to figure out what you want from there.
-
Mar 22nd, 2001, 06:18 PM
#3
Thread Starter
Hyperactive Member
Would there be a common method that would work in both? If not, an applet would be my target...
-JR-
"Blessed are we who can laugh at ourselves for we shall never cease to be amused"
- Unknown
-
Mar 22nd, 2001, 08:49 PM
#4
Dazed Member
Im happy your happy JWare! You should buy(or unless you already have) some books on Java. A good reference book is JAVA in a nutshell by O'Reilly and
if you want to do any GUI programming JAVA Swing
by O'Reilly is pretty good. For IO try JAVA IO by Elliotte Rusty Harold(another O'Reilly book)Try and learn stuff in chunks. IO,GUI, ect.... then bring it all togther.
Good Luck.....
-
Apr 2nd, 2001, 02:53 PM
#5
Thread Starter
Hyperactive Member
Back with this thread after a while...
I know, I should probaby get some books on the topic... but do you guys know how to do these things?
-JR-
"Blessed are we who can laugh at ourselves for we shall never cease to be amused"
- Unknown
-
Apr 2nd, 2001, 04:46 PM
#6
1) If you are using Sun's Java, there is a demo in baseDir\demo\sound "jdk1.3\demo\sound".
2) Not sure what you mean here. I've used java.awt.Image to load a graphic from a hard drive and then painted it inside a java.awt.Panel.
Code:
transient public static Image[] images = new Image[12];
static{
images[0] = Toolkit.getDefaultToolkit().getImage("..\\chessmen\\Wking.gif");
/...
3) Since you mentioned a button, I'd say use the java.net.URL class and network IO to read a stream.
http://java.sun.com/docs/books/tutor...ing/index.html
If you didn't mention the button, I was thinking of when I was trying to write my own browser and the above code would need to be executed on javax.swing.JEditorPane in the javax.swing.event.HyperlinkEvent
-
Apr 2nd, 2001, 05:40 PM
#7
Thread Starter
Hyperactive Member
Okay, I'll get back to this thread again, not able now... but thanks for the code, I'll try it out when have the chance.
-JR-
"Blessed are we who can laugh at ourselves for we shall never cease to be amused"
- Unknown
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|