Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Managing Audio Files In Java

  1. #1
    Junior Member
    Join Date
    Feb 2014
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Managing Audio Files In Java

    Hi guys!
    I'm doing a little game in Java and I would like to insert a background music managed by a JButton. When the button is pressed, the music starts and then, to stop it, the button is pressed again. If you don't press the button to stop the music remains in the loop until the player plays. Do you have any suggestions?


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Managing Audio Files In Java

    Can you make a button? Add an action listener to it? Write the action listener to start or stop the music?

    What do you need help with?

  3. #3
    Member
    Join Date
    Feb 2014
    Posts
    180
    Thanks
    0
    Thanked 48 Times in 45 Posts

    Default Re: Managing Audio Files In Java

    You do need to be more specific with what you need help with.

    For audio playback, Playing Sound in Java probably covers everything (start, stop and loop) you need to know at this stage.

    For UI construction, go through Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials), in particular How to Use Buttons, Check Boxes, and Radio Buttons (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components) and How to Write an Action Listener (The Java™ Tutorials > Creating a GUI With JFC/Swing > Writing Event Listeners).

    For anything else, please ask specific questions.

Similar Threads

  1. [SOLVED] Managing layout in JFrame
    By stewbond in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 26th, 2013, 07:52 AM
  2. Problem with Audio Files
    By haiderali in forum What's Wrong With My Code?
    Replies: 5
    Last Post: June 4th, 2013, 01:34 PM
  3. Threads, Audio Application, Audio loading twice error
    By dpjmie in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 19th, 2013, 01:18 PM
  4. Managing Http requests
    By maxitis in forum Java Networking
    Replies: 2
    Last Post: December 1st, 2012, 04:03 PM
  5. problem in managing layout
    By namreen in forum What's Wrong With My Code?
    Replies: 0
    Last Post: August 26th, 2010, 12:52 AM