NullPointer Error - HUH?

I’m not offended, i went to cittone institue, paramus, nj and took a programming course which includes Java as one of their subjects. However they just talked about the basic stuff you would normally learn from reading any java book, they didn’t do anything this advance like passing applet references like i’m doing here.

Its not included in my ide? dunno. Itried Eclipse for the very first time and it used half of my memory and ran as slow as h e double hockey sticks.

P.S. They used JCreator as the ide they reccommend you use for your java projects and that what they use to teach you the language. To make matters worse they use the LITE version, which has no code completion at all, its basicly notepad with a button to compile your code :frowning:

P.S.S They charged me $15,000 for the entire 7 month course but this is going off-topic

Oh… You got screwed :wink:

Passing around objects (like the Applet) is one of the most basic task to do in a programming language, actually. You might better have bought a book :stuck_out_tongue:

You need to change the constructor for Ball to accept a reference to the Applet, and invoke super(applet).

Use Eclipse. There is no installation involved with Eclipse. Just extract the folder, and run eclipse.exe. Create a workspace, create a project, copy your classes into the folder structure Eclipse has created, refresh the project in Eclipse’s Package Explorer. Eclipse is not hard to use at all.

Could I interest you in some organic jelly beans, only $599 each in packs of 10 8) Expensive for a 7 month course, what’s it in? One of those certified web developer courses?

But like people are saying, you would do better for yourself to remove the dependencies from Applet in your game. And as for your IDE, whether you spent $50 or $5,000 on your package, if Eclipse can help you then use it. Just see it as a package you also spent $2,000 on :smiley:

[quote]But like people are saying, you would do better for yourself to remove the dependencies from Applet in your game.
[/quote]
Ultimately, of course that would be best.
However, let’s just take it one step at a time. He’s still learning and already has difficulties with the concept of passing references. I suppose it’s better to at least get something working first, even if it is exclusively an applet (which is not so bad if you don’t plan to have it working as an application anyway).

True, I mean some people instinctively break down large systems while others (like myself) instinctively think bottom up. I’m guessing he thinks bottom up, which sucks for Java but is great for learning BASIC and assembler in DOS. I just wish I didn’t have so many commitments otherwise I would devote some time to developing tutorial/courses - the burden of writing a dissertation on learning and communication :frowning:

Well my reminder of the minute is, “a mistake is better than a missed take”. Although there is good reason not to learn bad practices as it takes longer to unlearn than it does to learn, it is sometimes much easier to grasp a particular concept when everything else is wrong. Plus you learn a lot from mistakes, such as why they are mistakes, and what you can do to avoid them. At least you’ve made a mistake.

Looking at code of yesteryear, I can see so many mistakes its unbelievable. Most of them were about maintainability, cohesion (like being your own ‘Mr independent’ class who doesn’t even need to know Applet) was one of them.

@keldon85,erikd: If i remove the Applet dependencies how will i load images and sounds, loading through the applet class are the only way that was tought to me.

@keldon85: The java part of the course was only 3 weeks. :o It was Html, Java, CSS, XML, Javascript, VB 6, and asp.

@All: i’m was planning on creating an applet and then use applet-desc and web-start to make it an application. If anyone knows how i can do both without rewritting the whole thing from scratch it would be appreciated.

Thanks All For The Support You Have Given Me :smiley:

Well I basically had my output class extend Panel, and then created two classes to each load either a Frame or an Applet to place the panel inside. As for loading, you can have both an applet and application reference resources using getResource(""). Store your resources inside of Jar files, and then link to them inside your manifest file’s list of class-files.

My project has seamless integration because of this; so my jar files work as a stand alone application, an applet and a web start application - all in one build.

As for your course, I sort of guessed it would have a fair amount of web work because we have the same sort of thing over here. Once you’re a certified developer you have the confidence to apply for jobs that are offering $40-$60k, sticking around here at Java Gaming will give you the added boost of having applet development experience.

Could you please provide some example code? I don’t seem to understand what you mean. I normally place both my frame and panel in the same class like my school tought me.

The school course is there to teach you the Java language and introduce you to the core classes so that you can get code running in an applet or application. You are unlikely to find any short course teaching you more advanced coding practises such as software engineering and the likes, unless they plan on charging you through the roof. Even Universities struggle to create a course that works for everyone, and their courses span a number of years!!!

Code example:

class ScreenPanel extends Panel {
	public void paint ( Graphics g ) {
		...
	}
}

class LaunchFrame {
	public static void main ( String argv[] ) {
		Frame frame = new Frame ("doop de doo");
		ScreenPanel screenPanel = new ScreenPanel();

		...

		frame.add(screenPanel);

		...

		new Game().start();
	}
}

class LaunchApplet extends JApplet {
	public void init (){
		getContentPane().add(new ScreenPanel());
		setSize ( ... );
	}

	public void start (){
		game = new Game();
		game.start();
	}
}

Question, is the game class something i’m supposed to code and if it is what do i put in it?