Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Application Programming

Reply
 
LinkBack Thread Tools
Old 04-28-09   #1 (permalink)
Linux Lobbyist
 
Pap3r's Avatar
 
intel nvidia

Join Date: Feb 2008
Location: ~/
Posts: 556

Rep: 40 Pap3r is acknowledged by some
Unique Rep: 35
Folding Team Rank: 1079
Trader Rating: 0
Default Java Game

So for one of my projects in my java programming class was to create a tic-tac-toe game with a menu up top. I have the game working, and I thought the menu code was right... but I keep getting compiling errors, all pertaining to the menu code. Here are the errors:
Code:
G:\Documents\Classes\CPT102\Task3\TicTacToe.java:34: cannot find symbol
symbol  : method setMenuBar(java.awt.MenuBar)
location: class TicTacToe
		setMenuBar(mnuBar);
		^
G:\Documents\Classes\CPT102\Task3\TicTacToe.java:38: cannot find symbol
symbol  : variable mnuFileClear
location: class java.awt.MenuItem
			MenuItem.mnuFileClear = new MenuItem("Clear");
			        ^
G:\Documents\Classes\CPT102\Task3\TicTacToe.java:39: cannot find symbol
symbol  : variable mnuFileClear
location: class TicTacToe
			mnuFile.add(mnuFileClear);
			            ^
G:\Documents\Classes\CPT102\Task3\TicTacToe.java:40: cannot find symbol
symbol  : variable mnuFileExit
location: class java.awt.MenuItem
			MenuItem.mnuFileExit = new MenuItem("Exit");
			        ^
G:\Documents\Classes\CPT102\Task3\TicTacToe.java:41: cannot find symbol
symbol  : variable mnuFileExit
location: class TicTacToe
			mnuFile.add(mnuFileExit);
			            ^
G:\Documents\Classes\CPT102\Task3\TicTacToe.java:45: cannot find symbol
symbol  : variable mnuAboutTic
location: class java.awt.MenuItem
			MenuItem.mnuAboutTic = new MenuItem("About Tic-Tac-Toe");
			        ^
G:\Documents\Classes\CPT102\Task3\TicTacToe.java:46: cannot find symbol
symbol  : variable mnuAboutTic
location: class TicTacToe
			mnuAbout.add(mnuAboutTic);
			             ^
G:\Documents\Classes\CPT102\Task3\TicTacToe.java:48: cannot find symbol
symbol  : variable mnuFileExit
location: class TicTacToe
		mnuFileExit.addActionListener(this);
		^
G:\Documents\Classes\CPT102\Task3\TicTacToe.java:49: cannot find symbol
symbol  : variable mnuFileClear
location: class TicTacToe
		mnuFileClear.addActionListener(this);
		^
G:\Documents\Classes\CPT102\Task3\TicTacToe.java:50: cannot find symbol
symbol  : variable mnuAboutTic
location: class TicTacToe
		mnuAboutTic.addActionListener(this);
		^
G:\Documents\Classes\CPT102\Task3\TicTacToe.java:52: cannot find symbol
symbol  : variable mnuFileExit
location: class TicTacToe
		mnuFileExit.setActionCommand("Exit");
		^
G:\Documents\Classes\CPT102\Task3\TicTacToe.java:53: cannot find symbol
symbol  : variable mnuFileClear
location: class TicTacToe
		mnuFileClear.setActionCommand("Clear");
		^
G:\Documents\Classes\CPT102\Task3\TicTacToe.java:54: cannot find symbol
symbol  : variable mnuAboutTIc
location: class TicTacToe
		mnuAboutTIc.setActionCommand("About");
		^
13 errors

Tool completed with exit code 1
And here's the menu section:
Code:
//Constructor
    public TicTacToe()
    {
		MenuBar mnuBar = new MenuBar();
		setMenuBar(mnuBar);

		Menu mnuFile = new Menu("File", true);
		mnuBar.add(mnuFile);
			MenuItem.mnuFileClear = new MenuItem("Clear");
			mnuFile.add(mnuFileClear);
			MenuItem.mnuFileExit = new MenuItem("Exit");
			mnuFile.add(mnuFileExit);

		Menu mnuAbout = new Menu("About", true);
		mnuBar.add(mnuAbout);
			MenuItem.mnuAboutTic = new MenuItem("About Tic-Tac-Toe");
			mnuAbout.add(mnuAboutTic);

		mnuFileExit.addActionListener(this);
		mnuFileClear.addActionListener(this);
		mnuAboutTic.addActionListener(this);

		mnuFileExit.setActionCommand("Exit");
		mnuFileClear.setActionCommand("Clear");
		mnuAboutTIc.setActionCommand("About");
That's just a little part of the constructor method. What's going on?
__________________
Q6600 G0 @ 3409
4600+ Manchester @ 2809.9
Member of the LGC
Quote:
Originally Posted by GoHigh
All that work in my bathroom for three hours and for what... 2c. All that stroking... back and forth...

System: Mod
CPU
Q6600 G0 @ 3390MHz
Motherboard
Asus P5Q
Memory
2x1g OCZ Reaper DDR2
Graphics Card
XFX 8800GT Alpha Dog Edition 767/1833
Hard Drive
WD 160G SATA
Sound Card
Onboard
Power Supply
Rosewill 550w SLI
Case
TT Tsunami
CPU cooling
Vendetta 2 w/ 3000rpm Ultra Kaze
GPU cooling
Stock
OS
Ubuntu
Monitor
Syncmaster 730B
Pap3r is offline I fold for Overclock.net   Reply With Quote
Old 06-03-09   #2 (permalink)
PC Gamer
 
arkheii's Avatar
 
Join Date: Oct 2007
Location: 囧國
Posts: 1,624

Rep: 51 arkheii is acknowledged by some
Unique Rep: 47
Trader Rating: 0
Default

Code:
G:\Documents\Classes\CPT102\Task3\TicTacToe.java:34: cannot find symbol
symbol  : method setMenuBar(java.awt.MenuBar)
location: class TicTacToe
		setMenuBar(mnuBar);
		^
I think everything stems from there. Your class TicTacToe doesn't have and doesn't inherit a setMenuBar(java.awt.MenuBar) method. Can you post TicTacToe's class definition (the part with the "public class TicTacToe extends etc implements etc")?

If you're making an Applet, you're out of luck because it can't have a menubar. Otherwise if your program is contained in a java.awt.Frame, you have to call the setMenuBar method of your program's Frame instance.

Code:
G:\Documents\Classes\CPT102\Task3\TicTacToe.java:38: cannot find symbol
symbol  : variable mnuFileClear
location: class java.awt.MenuItem
			MenuItem.mnuFileClear = new MenuItem("Clear");
Maybe you mean this instead? Same goes for the rest.

Code:
MenuItem mnuFileClear = new MenuItem("Clear");
I can't really tell much without seeing the rest of your code though.
__________________
CPU History: Manila -> Brisbane -> Wolfdale
GPU History: RV560 -> G94 -> R700 -> RV770XT

System: Melysa
CPU
E8400 C0 @ 4.0GHz 8x500
Motherboard
DFI LP JR P45-T2RS
Memory
4x1GB
Graphics Card
MSI 4870 OC 512MB
Hard Drive
Seagate 80GB 120GB 200GB; WD 500GB 1TB
Power Supply
Xigmatek NRP-MC651 650W
Case
Cooler Master HAF 932
CPU cooling
TRUE120 lapped + washer + Ultra Kaze 3000rpm
GPU cooling
stock
OS
Windows 7 RC
Monitor
Samsung 2493HM
arkheii is offline   Reply With Quote
Reply


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



All times are GMT -5. The time now is 06:56 AM.


Overclock.net is a Carbon Neutral Site Creative Commons License

Terms of Service / Forum Rules | Privacy Policy | DMCA Info | Advertising | Become an Official Vendor
Copyright © 2009 Shogun Interactive Development. Most rights reserved.
Page generated in 0.08568 seconds with 8 queries