Help with fun java Party planner applet that is not so much fun any more.

I am working on a code to produce a Java applet that will employ the use of a sound .wav file and images.  I  thought I was using the correct code, but already I am getting 12 errors - mostly on my .get and .set statements.  Here is what I have so far - I AM NOT ASKING FOR CODE, BUT DIRECTION IN WHERE I AM GOING WRONG.  I KNOW I'M A NEWBIE, BUT AN HONEST ONE THAT KEEPS FLIPPING BOOKS LOOKING FOR DIRECTION. -- Thank you!:

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;

public class JPartyPlannerTeamBcw1 extends JApplet implements ActionListener
{

private AudioClip sound;
Font bigFont = new Font("Helvetica", Font.BOLD, 24);
Font smallFont = new Font("TimesRoman", Font.ITALIC,14);
String header = new String ("Have you got an Event coming up?");
String title = new String ("Let us do the work so you can enjoy the party.");
String banner = new String("TEAM B PARTY PLANNERS INC");
String list =  new String ("invitations, supplies, decorations and more!");
JButton aboutUsBut = new JButton("About our Company");
JButton contactButton = new JButton("Contact us");
JButton partyButton = new JButton("Our Party Experts");

ImageIcon icon1 = new ImageIcon("rocket.gif");
ImageIcon icon2 = new ImageIcon("gift.gif");
ImageIcon icon3 = new ImageIcon("smallRocket.gif");
ImageIcon icon4 = new ImageIcon("starburst_multicolor.gif");

public void init()
{
sound = getAudioClip(getCodeBase(),"Celebration.wav");

Container con = getContentPane();
con.setBackground(Color.black);
con.setLayout(new FlowLayout());
banner.setFont(bigFont);
con.add(banner, 100,20);

header.setFont(smallFont);
con.add(header, 90,50);
list.setFont(smallFont);
con.add(list, 80,140);
con.add(icon4, 10,20);
con.add(icon4, 260,20);
con.add(icon2, 160,100);
con.add(aboutUsBut, 60,200);
aboutUsBut.addActionListener(this);
con.add(contactButton, 120,200);
contactButton.addActionListener(this);
con.add(partyButton,180,200);
partyButton.addActionListener(this);
}

public void actionPerformed(ActionEvent thisEvent)
{
      Graphics gr = getGraphics();
      Object source = thisEvent.getSource();
      if(source == aboutUsBut)
      gr.drawString("Team B Party Planning, Inc - established February 2006", 20,220);

      else if (source == contactButton)
      gr.drawString("Contact us at www.TeamBPartyPlan.com or 555.123.2323", 60,240);

      else if (source == partyButton)
      gr.drawString("Our expert team is comprised of Brent, Steve, Cyndy and Chad", 80,260);

}
}





cyndylove46Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mick BarryJava DeveloperCommented:
you can't set the font for a string.
nor add a string or image to your container.

you instead need to create JLabels and set the font for them and add the lable to your container

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mick BarryJava DeveloperCommented:
JLabel headerLabel = new JLabel(header);
headerLabel.setFont(smallFont);
con.add(headerLabel);
cyndylove46Author Commented:
Thank you "objects"..  I have taken another route to this code.  I felt I could better manipulate location and font attributes with the following code, however I am having a bear of a time adding sound and .gif files.  Ideas?

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.util.*;

public class JPartyPlannerTeamBcwb extends JApplet
{
      private AudioClip sound;
      String companyName = new String("TEAM B PARTY PLANNERS INC.");
      String questionLine = new String("Have you got a special event coming up?");
      String offerLine = new String ("Let us do the work so you can ENJOY the party");
      String list = new String ("Location? Invitations? Decorations?  We do it all and a bit more!");
      Font bigFont = new Font("Helvetica", Font.BOLD, 24);
      Font midFont = new Font("Helvetica",Font.ITALIC, 14);
      Font smallFont = new Font("Helvetica", Font.PLAIN, 10);
      private ImageIcon partyLogo;
      JButton aboutUsBut = new JButton("About our Company");
      JButton contactButton = new JButton("Contact us");
      JButton partyButton = new JButton("Our Party Experts");

      public void init()
      {

      sound = getAudioClip(getCodeBase(),"Celebration.wav");
      partyLogo = new ImageIcon("starburst_multicolor.gif");
      Container con = getContentPane();
      con.setBackground(Color.darkGray);
      con.setLayout(new FlowLayout());

}



public void paint(Graphics gr)
{
      setBackground(Color.darkGray);
      gr.setFont(bigFont);
      gr.setColor(Color.cyan);
      gr.drawString(companyName, 60,100);
      gr.setFont(midFont);
      gr.setColor(Color.orange);
      gr.drawString(questionLine, 100,140);
      gr.setFont(midFont);
      gr.setColor(Color.orange);
      gr.drawString(offerLine, 80,160);
      gr.setFont(midFont);
      gr.setColor(Color.orange);
      gr.drawString(list, 40, 180);



}
}
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

Manikandan ThiagarajanSenior consultantCommented:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;

public class JPartyPlanner extends JApplet implements ActionListener
{

private AudioClip sound;
Font bigFont = new Font("Helvetica", Font.BOLD, 24);
Font smallFont = new Font("TimesRoman", Font.ITALIC,14);
String header = new String ("Have you got an Event coming up?");
String title = new String ("Let us do the work so you can enjoy the party.");
String banner = new String("TEAM B PARTY PLANNERS INC");
String list =  new String ("invitations, supplies, decorations and more!");
JButton aboutUsBut = new JButton("About our Company");
JButton contactButton = new JButton("Contact us");
JButton partyButton = new JButton("Our Party Experts");

ImageIcon icon1 = new ImageIcon("rocket.gif");
ImageIcon icon2 = new ImageIcon("gift.gif");
ImageIcon icon3 = new ImageIcon("smallRocket.gif");
ImageIcon icon4 = new ImageIcon("starburst_multicolor.gif");

public void init()
{
sound = getAudioClip(getCodeBase(),"Celebration.wav");

Container con = getContentPane();
con.setBackground(Color.black);
con.setLayout(new FlowLayout());
JLabel headerLabel = new JLabel(header);
headerLabel.setFont(smallFont);
con.add(headerLabel);

JLabel title1 = new JLabel(title);
headerLabel.setFont(smallFont);
con.add(title1);

JLabel banner1 = new JLabel(banner);
headerLabel.setFont(bigFont);
con.add(banner1);

JLabel list1 = new JLabel(banner);
headerLabel.setFont(smallFont);
con.add(list1);
//banner.setFont(bigFont);
//con.add(banner, 100,20);

//header.setFont(smallFont);
//con.add(header, 90,50);
//list.setFont(smallFont);
//con.add(list, 80,140);
//con.add(icon4, 10,20);
//con.add(icon4, 260,20);
//con.add(icon2, 160,100);
con.add(aboutUsBut);
aboutUsBut.addActionListener(this);
con.add(contactButton);
contactButton.addActionListener(this);
con.add(partyButton);
partyButton.addActionListener(this);
}

public void actionPerformed(ActionEvent thisEvent)
{
     Graphics gr = getGraphics();
     Object source = thisEvent.getSource();
     if(source == aboutUsBut)
     gr.drawString("Team B Party Planning, Inc - established February 2006", 20,220);

     else if (source == contactButton)
     gr.drawString("Contact us at www.TeamBPartyPlan.com or 555.123.2323", 60,240);

     else if (source == partyButton)
     gr.drawString("Our expert team is comprised of Brent, Steve, Cyndy and Chad", 80,260);

}
}




Manikandan ThiagarajanSenior consultantCommented:
try that code but  drawing part you havet to put in paint method
Manikandan ThiagarajanSenior consultantCommented:
could you tell me your exact problem now. if(source == aboutUsBut)

{

repaint();

}
 here you call the repaint method that would call the public void paint method
cyndylove46Author Commented:
I have it running now...THANK YOU ALL.  I am still stuck on the music file.  I gut a nullpointer error when I try to direct the program to use the .wav file.  It will compile, but not run the applet or use the .wav.  I downloaded the wav from a free online spot and saved it to the folder that contains my java program and the HTML applet file, but I wonder if there are security tags I am unaware of that halts the use of the .wav file?

I won't give up.  I feel I am close to an answer.  
Mick BarryJava DeveloperCommented:
where is the audio file? it should be in the same directory as the class files
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.