Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 26th, 2006, 9:59 AM   #1
Arenlor
Newbie
 
Join Date: Apr 2006
Posts: 2
Rep Power: 0 Arenlor is on a distinguished road
DiveLog.java tutorial help

Every time that I try to compile this it gives me the same error, and I can't figure out what I did wrong with this code. Did I miss something in the tutorial or something? I get this error
DiveLog.java:62: cannot find symbol
symbol  : class Welcome
location : class divelog.DiveLog
                                  new Welcome(),
                                         ^
That occurs for Diver, Dives, Statistics, WebSite, and Resources, just replacing the correct word.
package divelog;

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


public class DiveLog
{ // Opens DiveLog class
private JTabbedPane tabbedPane;
private JFrame dlframe;



public DiveLog()
	{// Opens DiveLog constructor

	// Create a frame object to add the application
	// GUI components to.

	dlframe = new JFrame("A Java(TM) Technology Dive Log");

	// Closes from title bar
	// and from menu
	dlframe.addWindowListener(new WindowAdapter()
	{ // Opens addWindowListener method
	public void windowClosing(WindowEvent e)
	{ //Opens windowClosing method
	System.exit(0);
	} // Closes windowClosing method
	}); // Closes addWindowListener method


	// Tabbed pane with panels for Jcomponents

	tabbedPane = new JTabbedPane(SwingConstants.LEFT);
	tabbedPane.setBackground(Color.blue);
	tabbedPane.setForeground(Color.white);

	// Calls a method that adds individual tabs to the
	// tabbedpane object.
	populateTabbedPane();

	// Calls the method that builds the menu
	buildMenu();

	dlframe.getContentPane().add(tabbedPane);

	dlframe.pack();
	dlframe.setSize(765, 690);
	dlframe.setBackground(Color.white);
	dlframe.setVisible(true);
	} // Ends class constructor

private void populateTabbedPane()
	{ // Opens populateTabbedPane method definition
	// Create tabs with titles


	tabbedPane.addTab("Welcome",
			null,
			new Welcome(),
			"Welcome to the Dive Log");


	tabbedPane.addTab("Diver Data",
			null,
			new Diver(),
			"Click here to enter diver data");


	tabbedPane.addTab("Log Dives",
			null,
			new Dives(),
			"Click here to enter dives");


	tabbedPane.addTab("Statistics",
			null,
			new Statistics(),
			"Click here to calculate dive statistics");


	tabbedPane.addTab("Favorite Web Site",
			null,
			new WebSite(),
			"Click here to see a web site");


	tabbedPane.addTab("Resources",
			null,
			new Resources(),
			"Click here to see a list of resources");
} // Ends populateTabbedPane method


private void buildMenu()
	{ // Opens buildMenu method definition
	JMenuBar mb = new JMenuBar();
	JMenu menu = new JMenu("File");
	JMenuItem item = new JMenuItem("Exit");

	// Closes the application from the Exit
	// menu item.
	item.addActionListener(new ActionListener()
	{ // Opens addActionListener method
	public void actionPerformed(ActionEvent e)
	{ // Opens actionPerformed method
	System.exit(0);
	} // Closes actionPerformed method

	}); // Closes addActionListener method


	menu.add(item);
	mb.add(menu);
	dlframe.setJMenuBar(mb);
	} // Closes buildMenu method


// main method and entry point for app
public static void main(String[] args)
	{ // Opens main method

	DiveLog dl = new DiveLog();


	} // Closes main method



} // Ends class DiveLog

As per their instructions I made the classes for Welcome, etc. Here is the code in them.
package divelog;

import java.awt.*;
import javax.swing.*;


public class Welcome extends JPanel
{ // Opens class

   
} // Closes class

I am trying to be able to complete the tutorial by Tuesday morning, when I take the AP Computer Science AB exam.
I'm attaching the DiveLog.java file in a text file, just converted it, so that if you need to play with it in order to fix it you can.
Attached Files
File Type: txt DiveLog.txt (2.8 KB, 16 views)
Arenlor is offline   Reply With Quote
Old Apr 26th, 2006, 10:01 AM   #2
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,650
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
My guess is that java isn't finding the Welcome class. One of the ways around this is to add the path to the directory where your java programs are stored into the CLASSPATH system variable.
for windows:
http://java.sun.com/j2se/1.3/docs/to...classpath.html
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is offline   Reply With Quote
Old Apr 26th, 2006, 10:11 AM   #3
Arenlor
Newbie
 
Join Date: Apr 2006
Posts: 2
Rep Power: 0 Arenlor is on a distinguished road
Thankyou, that solved it.
Arenlor is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:26 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC