Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 29, 2013, 02:18 AM   #1
Halamire
macrumors regular
 
Join Date: Dec 2009
Java Help

Any of you good at java? I have a quick question
My code wont compile. The error is in the main method. Every time i try to call hr and m to get the randomly generated time to compare with the user time, it gives me the red error line.
Am i not linking the class to the Main method right?

Last edited by Halamire; Apr 29, 2013 at 10:24 PM. Reason: Thanks!
Halamire is offline   0 Reply With Quote
Old Apr 29, 2013, 11:10 AM   #2
truehybridx
macrumors member
 
Join Date: Dec 2010
Before you get yelled at, you should go here and fix your post http://forums.macrumors.com/showthread.php?t=1356447

What error is it giving you?
truehybridx is offline   0 Reply With Quote
Old Apr 29, 2013, 11:16 AM   #3
andrewheard
macrumors regular
 
Join Date: May 2005
Location: Ontario, Canada
Send a message via MSN to andrewheard
I think you accidentally forgot to create the variable "s". You could change
Code:
private static final SwingCanvas SwingCanvas = null;
to
Code:
private static SwingCanvas s = null;
and then change your Clock constructor to set that variable by changing
Code:
setContentPane(new SwingCanvas());
to
Code:
s = new SwingCanvas();
setContentPane(s);
It has been years since I've done Java GUI development so I have no idea if you are following best practices but these changes will at least fix your error.

Hope this helps,

Andrew
__________________
Tunesify - Simply the easiest way to convert audio.
andrewheard is offline   0 Reply With Quote
Old Apr 29, 2013, 10:23 PM   #4
Halamire
Thread Starter
macrumors regular
 
Join Date: Dec 2009
Thank you so much! Other than my if statements it works!
Halamire is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Tags
java, programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Some apps prompt to install Java 6 even when Java 7 is installed MacMan988 OS X Mavericks (10.9) 1 Apr 18, 2014 08:56 AM
Java 6 or Java 7 for OSX Mavericks for your Macbook Pro? Starfyre MacBook Pro 3 Dec 22, 2013 04:49 PM
Java 6.x security risk (?) vs Java 7.x and broken apps w/ v7.x installs? mgiamo Mac Basics and Help 1 Dec 15, 2013 04:48 PM
Chrome on OS X -- Java plugin / Java 7 vs Java 6 Issue booyahbooyah Mac Applications and Mac App Store 4 May 31, 2013 10:13 AM
Installed Java 7.07 but doesn't show up in Java preferences? -mattias- OS X 10.8 Mountain Lion 21 Aug 31, 2012 05:49 PM

Forum Jump

All times are GMT -5. The time now is 02:52 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC