Results 1 to 7 of 7

Thread: A few simple how-to's...

  1. #1

    Thread Starter
    Hyperactive Member Jareware's Avatar
    Join Date
    Nov 2000
    Location
    Silicon Valley, CA
    Posts
    275
    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

  2. #2
    Hyperactive Member
    Join Date
    May 2000
    Posts
    367

    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.

  3. #3

    Thread Starter
    Hyperactive Member Jareware's Avatar
    Join Date
    Nov 2000
    Location
    Silicon Valley, CA
    Posts
    275
    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

  4. #4
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    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.....

  5. #5

    Thread Starter
    Hyperactive Member Jareware's Avatar
    Join Date
    Nov 2000
    Location
    Silicon Valley, CA
    Posts
    275

    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

  6. #6
    Guest

    Thumbs up

    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

  7. #7

    Thread Starter
    Hyperactive Member Jareware's Avatar
    Join Date
    Nov 2000
    Location
    Silicon Valley, CA
    Posts
    275
    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
  •  



Click Here to Expand Forum to Full Width