Help,
I keep getting a NullPointerException when trying to load the following aplpet.
Can someone please help - it's 1 of 6 programs I'm writting for my final in an
intro to java class and I haven't been able to track down the problem. Below is
the output of the java console and the applet and html code. Any help would be
greatly appreciated
-------------------------------------------------------------------------------------
<APPLET CODE = "VTour.class" WIDTH = 350 HEIGHT = 200 >
<PARAM name="Prev-passive" value="Pbutton2.gif">
<PARAM name="Prev-active" value="Pbutton3.gif">
<PARAM name="Prev-disable" value="Pbutton4.gif">
<PARAM name="Next-passive" value="Nbutton2.gif">
<PARAM name="Next-active" value="Nbutton3.gif">
<PARAM name="Next-disable" value="Nbutton4.gif">
<PARAM name="Photo1" value="nophoto.gif">
<PARAM name="Photo2" value="nophoto.gif">
<PARAM name="Photo3" value="nophoto.gif">
<PARAM name="Photo4" value="nophoto.gif">
<PARAM name="Photo5" value="nophoto.gif">
</APPLET>
---------------------------------------------------------------------------
-------------------------------------------------------------------------------------
Netscape Communications Corporation -- Java 1.1.5
java.lang.NullPointerException: trying to call
getProperty(Ljava/lang/String;Ljava/awt/image/Im
at javax.swing.ImageIcon.<init>(ImageIcon.java:124)
at VTour.initComponents(VTour.java:40)
at VTour.init(VTour.java:7)
* at
netscape.applet.DerivedAppletFrame$InitAppletEvent.dispatch(DerivedAppletFrame.java:553)
at java.awt.EventDispatchThread$EventPump.dispatchEvents(EventDispatchThread.java:81)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:135)
at
netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run(DerivedAppletFrame.java:911)
---------------------------------------------------------------------------------------
import javax.swing.*;
public class VTour extends java.applet.Applet {
/** Initializes the Form */
public void init () {
initComponents ();
}
private void initComponents () {
setLayout (new java.awt.BorderLayout ());
//NORTH
jTitlePanel = new JPanel ();
jTitlePanel.setLayout (new java.awt.FlowLayout ());
jTitleLabel = new JLabel ();
jTitleLabel.setText ("Java Jive University Virtual Tour");
jTitlePanel.add (jTitleLabel);
add (jTitlePanel, "North");
//END NORTH
//CENTER
jSlidePanel = new JPanel ();
jSlidePanel.setBorder (new javax.swing.border.SoftBevelBorder (0));
jSlidePanel.setLayout (new java.awt.CardLayout ());
jPanel1 = new JPanel ();
jPanel1.setLayout (new java.awt.FlowLayout ());
jSlidePanel.add (jPanel1, "card2");
add (jSlidePanel, "Center");
//END CENTER
//WEST
jPrevButton = new JButton ();
jPrevButton.setPressedIcon (new ImageIcon (this.getImage(this.getDocumentBase(),this.getParameter("Prev-active"))));
jPrevButton.setIcon (new ImageIcon (this.getImage(this.getDocumentBase(),this.getParameter("Prev-passive"))));
jPrevButton.setRolloverEnabled (true);
jPrevButton.setBackground (java.awt.Color.lightGray);
jPrevButton.setDisabledIcon (new ImageIcon (this.getImage(this.getDocumentBase(),this.getParameter("Prev-disable"))));
jPrevButton.setBorder (new javax.swing.border.SoftBevelBorder (0));
jPrevButton.setDebugGraphicsOptions ( DebugGraphics.BUFFERED_OPTION);
jPrevButton.setToolTipText ("Next Image");
jPrevButton.setDoubleBuffered (true);
jPrevButton.setDisabledSelectedIcon (new ImageIcon (this.getImage(this.getDocumentBase(),this.getParameter("Prev-disable"))));
jPrevButton.setRolloverIcon (new ImageIcon (this.getImage(this.getDocumentBase(),this.getParameter("Prev-active"))));
jPrevButton.addActionListener (new java.awt.event.ActionListener () {
public void actionPerformed (java.awt.event.ActionEvent evt) {
jPrevButtonActionPerformed (evt);
}
}
);
add (jPrevButton, "West");
//END WEST
//EAST
jNextButton = new JButton ();
jNextButton.setPressedIcon (new ImageIcon ("NbuttonImage3.gif"));
jNextButton.setIcon (new ImageIcon ("NbuttonImage2.gif"));
jNextButton.setRolloverEnabled (true);
jNextButton.setBackground (java.awt.Color.lightGray);
jNextButton.setDisabledIcon (new ImageIcon ("NbuttonImage4.gif"));
jNextButton.setBorder (new javax.swing.border.SoftBevelBorder (0));
jNextButton.setDebugGraphicsOptions ( DebugGraphics.BUFFERED_OPTION);
jNextButton.setToolTipText ("Next Image");
jNextButton.setDoubleBuffered (true);
jNextButton.setRolloverIcon (new ImageIcon ("NbuttonImage3.gif"));
jNextButton.addActionListener (new java.awt.event.ActionListener () {
public void actionPerformed (java.awt.event.ActionEvent evt) {
jNextButtonActionPerformed (evt);
}
}
);
add (jNextButton, "East");
//END EAST
//SOUTH
jCaptionTextArea = new JTextArea ();
jCaptionTextArea.setText ("Captions for the slide show go here !");
jCaptionTextArea.setSelectedTextColor (java.awt.Color.white);
jCaptionTextArea.setForeground (java.awt.Color.white);
jCaptionTextArea.setBackground (java.awt.Color.black);
jCaptionTextArea.setFont (new java.awt.Font ("SansSerif", 0, 14));
jCaptionTextArea.setBorder (new javax.swing.border.BevelBorder (0));
jCaptionTextArea.setEditable (false);
add (jCaptionTextArea, "South");
//END SOUTH
}//GEN-END:initComponents
private void jPrevButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPrevButtonActionPerformed
// Add your handling code here:
}//GEN-LAST:event_jPrevButtonActionPerformed
private void jNextButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPrevButtonActionPerformed
// Add your handling code here:
}//GEN-LAST:event_jPrevButtonActionPerformed
// Variables declaration
private JTextArea jCaptionTextArea;
private JPanel jSlidePanel;
private JPanel jTitlePanel;
private JButton jPrevButton;
private JButton jNextButton;
private JLabel jTitleLabel;
private JPanel jPanel1;
}