This program was working now when I try to run it, it throws this error "NoClassDefFoundError", I looked on suns site, but don't understand what is missing. Here is the code:
// ---------------------------------------------------------------------------
// Import the packages used by this class
// ---------------------------------------------------------------------------
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
// ---------------------------------------------------------------------------
// PortfolioTotalsPanel Class
// ---------------------------------------------------------------------------
public class PortfolioTotalsPanel extends JPanel
{
// Create our labels
JLabel lblDollarChange = new JLabel( "Dollar Change: $1000", JLabel.CENTER );
JLabel lblPercentChange = new JLabel( "Percent Change: 50%", JLabel.CENTER );
// -----------------------------------------------------------------------
// Constructor
// -----------------------------------------------------------------------
public PortfolioTotalsPanel()
{
// Set the layout manager
setLayout( new GridLayout( 2, 1 ) );
// Add the labels to the JPanel
add( lblDollarChange );
add( lblPercentChange );
}
// -----------------------------------------------------------------------
// Main application entry point into this class
// -----------------------------------------------------------------------
public static void main( String[] args )
{
// Create a JFrame object
JFrame frame = new JFrame( "Portfolio Totals" );
// Create an PortfolioTotalsPanel Object
PortfolioTotalsPanel app = new PortfolioTotalsPanel();
// Add our PortfolioTotalsPanel Object to the JFrame
frame.getContentPane().add( app, BorderLayout.CENTER );
// Resize our JFrame
frame.setSize( 600, 100 );
// Make our JFrame visible
frame.setVisible( true );
// Create a window listener to close our application when we
// close our application
frame.addWindowListener
(
new WindowAdapter()
{
public void windowClosing( WindowEvent e )
{
System.exit( 0 );
}
}
);
}
}
// ---------------------------------------------------------------------------
// Import the packages used by this class
// ---------------------------------------------------------------------------
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
// ---------------------------------------------------------------------------
// PortfolioTotalsPanel Class
// ---------------------------------------------------------------------------
public class PortfolioTotalsPanel extends JPanel
{
// Create our labels
JLabel lblDollarChange = new JLabel( "Dollar Change: $1000", JLabel.CENTER );
JLabel lblPercentChange = new JLabel( "Percent Change: 50%", JLabel.CENTER );
// -----------------------------------------------------------------------
// Constructor
// -----------------------------------------------------------------------
public PortfolioTotalsPanel()
{
// Set the layout manager
setLayout( new GridLayout( 2, 1 ) );
// Add the labels to the JPanel
add( lblDollarChange );
add( lblPercentChange );
}
// -----------------------------------------------------------------------
// Main application entry point into this class
// -----------------------------------------------------------------------
public static void main( String[] args )
{
// Create a JFrame object
JFrame frame = new JFrame( "Portfolio Totals" );
// Create an PortfolioTotalsPanel Object
PortfolioTotalsPanel app = new PortfolioTotalsPanel();
// Add our PortfolioTotalsPanel Object to the JFrame
frame.getContentPane().add( app, BorderLayout.CENTER );
// Resize our JFrame
frame.setSize( 600, 100 );
// Make our JFrame visible
frame.setVisible( true );
// Create a window listener to close our application when we
// close our application
frame.addWindowListener
(
new WindowAdapter()
{
public void windowClosing( WindowEvent e )
{
System.exit( 0 );
}
}
);
}
}