Sun Java Tutorial Trail Out of Date!?!

Firstly if this is posted in the wrong forum, sorry

I’m a newbie Java programmer and have been following the online SUN trails. Bored I jumped to the JAVA2d trail only to receive compile messages like;

Note: Map_Line.java uses or overrides a deprecated API.

I’ve downloaded 1.5 SDK is this wrong? The reason being that i wanted to start learning the latest version.

There are lots on online examples of basic game loops most of which when i compile have the same error.

Is there a major change in 1.5

Thanks for any help…

It happens.
Alot of old code will give that warning when compiled with 1.5, because Window.show()/hide() have finally been deprecated (in favour of setVisible(true/false);

Even the javadocs arn’t fully uptodate yet :stuck_out_tongue:
Quote from Javadoc comments for java.awt.Frame.

[quote]The dimensions of the border area may be obtained using the getInsets method, however, since these dimensions are platform-dependent, a valid insets value cannot be obtained until the frame is made displayable by either calling pack or show
[/quote]
However, it is only a warning, and as such can be ignored… most of the time :wink:

Yes, you’ve downloaded the wrong version. 1.5 is not yet available, you are using a beta (I blame all the open-source developers and games developers who charge people for betas for spreading the impression that it’s generally a good idea to use something with the tag “beta” :P)

EDIT: and it’s OK to use 1.5 beta, but be aware lots of things could be temporarily broken; if you have any unexpected problems, download 1.4.2 and see if it works there (note: you may need Toby’s retroweaver, that lets you run 1.5 code using 1.4.x - http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=tools;action=display;num=1079033528)

However, “deprecated” is not an error, just a warning. All it means is that the method/whatever should no longer be used because there’s a better version (or some other reason).

IIRC there have been things that have been removed in the next major version (so if it’s deprecated in 1.5, you can guarantee it will still be there at least until we get to 1.6, which could be 3-5 years away), but there are also deprecated things that have never been removed - e.g. Thread.stop() and Thread.start().

I thought they only removed things that were fundamentally broken, or exposed a security hole.
They won’t ever remove deprecated stuff, as it will prevent users from updating their VMs if they rely on old code.

Ofcourse, having said that, most companies wouldn’t risk upgrading the VM if they had a significant catalog of legacy code.

Trimming all the deprecated stuff out of the core api would sure help streamline the Runtime download though :slight_smile:

Wow thanks for your swift replies!!! What a great forum membership!!

Ok one last question, where is the balls.jar demo?! I’ve searched the forum back 2 years and nothing.

[quote]Wow thanks for your swift replies!!! What a great forum membership!!

Ok one last question, where is the balls.jar demo?! I’ve searched the forum back 2 years and nothing.
[/quote]
Get it here:
http://www.pkl.net/~rsc/downloads/Balls.jar

I’m in the process of rewriting it to include/demonstrate the performance of all the new features in 1.5.

(all the BufferedImage types for instance.)

[quote]I thought they only removed things that were fundamentally broken, or exposed a security hole.
They won’t ever remove deprecated stuff, as it will prevent users from updating their VMs if they rely on old code.
[/quote]
As I said, it’s “IIRC”. I can think of things that haven’t been removed, but struggle to recall any that have. However, I was definitely taught originally (back in java 1.0/1.1) that deprecation = tagged for possible removal. Removal was never guaranteed…

Hmm. Perhaps it’s that deprecated tags don’t have to be implemented by new JVM writers? That would explain why I was taught they “might be missing”. Did mucho searching on deprecated and the JLS but didn’t find anything authoritative :(.

[quote]Perhaps it’s that deprecated tags don’t have to be implemented by new JVM writers?
[/quote]
That would make sense.

That is a very impressive demo!! Beyond my comprehension right now, but something to aim for!

Last question, are some of the classes in the balls.jar locked because you want to protect your source code or because i’m doing something wrong? I downloaded Netbeans just to load the jar file and it seems i don;t have access to GameFrame or Particle. I am in well over my head so please ignore me if i’m being a complete donut.

By the way i love the "println(“poo”), my perl scripts are full of stuff like that!.

None of the code is protected in any way, I prolly just made a mistake when I built the jar :smiley:

[edit]
I Just checked, and the sourcecode to the utility classes is what is missing (GameFrame, DisplayModeDialog, DragManaged etc etc)
[/edit]

I don’t have the sourcecode of those classes anymore (atleast, not in the state they were in when I built them)
You can always decompile them with DJ Java Decompiler or a similar tool.
You won’t be missing much, as I don’t put a whole lot of documentation in anyway :slight_smile:

I’ll finish off the new version today, and post it with complete sourcecode.

Abuse, the link above still leads to a jar with incomplete source code. If you havnt finished it please ignore this.

thanks

[quote]Abuse, the link above still leads to a jar with incomplete source code. If you havnt finished it please ignore this.

thanks
[/quote]
I’m rewriting it, and adding tonnes of new tests for benchmarking the new opengl accelerated features of 1.5beta2.

Great, I look forward to seeing it

[quote]Great, I look forward to seeing it
[/quote]
It isn’t exactly a priority atm, as i’m (amongst other things) looking for a job :stuck_out_tongue:

no problem