I was trying to figure out how to insert pictures into Java, but as music in the background plays, the pictures alternate. It would be really great if someone could include the music code too. Thanks for any help in advance.

What have you got so far?

I think he figured out that the best way to get to where he wants to go is to try to trick other people into writing the actual code...

Luckly I already have(ish). I found this lying around with some other things I was messing with. Obviously this is not code that you ought to use (it is needlessly redundant in many aspects). It seems you do not know where to starty (you posted no code) anyway hope this helps you get started, good luck! Alos it does not include sound but I believe sound would be quite easy to add. http://stackoverflow.com/a/10237397

public class applet extends Applet
{
    Image img;
    public void paint (Graphics g)
    {
        if (second()<=30)
        {
            img = getImage(getCodeBase(), "a.jpg ");

        }
        else
        if (second()>30)
        {
            img = getImage(getCodeBase(), "b.jpg ");

        }
        g.drawImage(img, 50, 50, 700, 500, this);
        repaint();

    }

    public int second()
    {
        Calendar now = Calendar.getInstance();
        int mili = now.get(Calendar.SECOND);
        return mili;
    }

}

wrong design, wrong notifiers, most important is repaint(); inside paint/PaintComponent (repaint from itself) caused endless loop with high CPU and GPU usage, missing there stop repainting for contianer or super.paint() as 1st code line in paint, otherwise nothing will be repainted correctly, only nice flickering

@howemonster Thanks for your help. It was very much appreciated and lead me in the right direction.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.