Mathias Nilsson

Ranch Hand
+ Follow
since Oct 13, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Mathias Nilsson

Ok! It is a tetris like game. Here is the code.

The Grid class

The Shape class

The Applet

The classes are compiled with -target 1.1. I use java sdk 1.4
Hope this helps!
20 years ago
I get this exception when i display my applet in a browser.
I can get i directly after load or when i reload the browser page.
Does anybody have a solution to this problem?
20 years ago
Something like this
I create a Object like this

I would like every menuItem to be a object and to have it's own paint method and so on. The problem is that i don't know how to do the loop and to paint the whole menu ....
by the way... the menu I looking for is something like the one used here.
I developed the site myself but I can't figure out how to make the menu in more than one step.
[ April 15, 2004: Message edited by: Mathias Nilsson ]
Hi all!
I'm trying to make a javascript menu that don't have a limit in how many children it can have.
I don't want to use layers since i have to make a own scrollbar. ( If the menu expands you can't see the entire menu ).
So i've desided to make the menu in the frameset and then go parent.menu.paint() from the frame.
My biggest problem is that I can't get my adding a child to a parent thing to work. How do you make a linked list in javascript?
I don't want a URL to a complete meny since I like to do it myself but it's difficult to know how to linked the parents and children in a menu.
Please help!
// Mathias
If you declare a class "abstract" then it cannot be instantiated. That is you can't make an instance of it.
The diffrence between an abstract class and a interface is that an abstract class can have none abstract methods.
If you should make a abstract class of a man,woman,boy,etc then you should try to locate something that they all have incommon.
Ears, Eyes, head, neck, body, and so on.
In an abstract class you can return values in a method

if you had a abstract method in the abstract class then you would force the Girl class to include the method.


Here you would have a compile error because the Girl class didn't include the getName method. It's up to the Girl class to supply the implementation of the getName() method.
Hope this make sence. There are probably experienced java programmers that would explain this more clearly.
// Mathias
20 years ago
Nope! You can use javac myApplet.java -target 1.1
// Mathias
20 years ago
Ok! I've managed to open a new window from java without a toolbar.
First! Add netscape.javascript to your classpath. If you are using jdk1.4
then you can reference jdk1.4\jre\lib\jaws.jar. It contains the netscape package.
when this is done you create your html file. Dont forget to add the element
MAYSCRIPT to your applet description.
Se example. ( HTML file that contains the applet )

And here is our Test class.

Try it out. Pretty cool
20 years ago
It seems to me that you can use the
netscape.javascript.*; package. It enables opening a new window from
an Applet without the toolbar. Search google for this.
here is a good page on the matter
// Mathias
[ April 14, 2004: Message edited by: Mathias Nilsson ]
20 years ago
Hi!
If I understand you right you have a window that contains a applet. From that window would you like to open another window and close the parent window.
If you shall open a new window without toolbar etc from the applet then i don't know, but if you click a link in the document containg the applet then you can do it with javascript. When the new window opens you can close the parent window.
// First html page with the applet

When you have pressed the link and the other window opens
20 years ago
Hello!
I have a question on the graphics object!
I'm trying to make my first java game and just wonder.
Do I have to use the same graphics object that is passed to the paint() method in the applet? If I use another graphicsobject in another class then
It doesn't paint anything on the applet. It's just that it is very annoying
to pass the Graphics object to every other method.
Is there anybody who can tip me on what is good programming? I want
to have a paint method in another class so that the class can handle it's own painting.
// Mathias
20 years ago
I didn't mean that you should put the code snippet in your class file. Rather in your html document that holds the applet attribut.
// Mathias
20 years ago
Yes! Thanks... I did that..
Is there a diffrence in performance on
Vector.add(); java 1.2
Vector.addElement(); java 1.1
Does the browsers support 1.2 or just 1.1?
// Mathias
20 years ago
ok! I Saw that ArrayList is java 1.2.
What type of collection do you recommend to store arrays of objects
in? I want the fastest one if it is possible.
// Mathias
20 years ago
Hi all!
I'm having a hard time getting my falling block applet game to work.
First of all I have to compile my java files using -target 1.1.
When I use a class I've made to handle the squares in my game I get an error. It seams that I can't use ArrayList?
Does anyone have a solution to this problem?
Here is my Grid class. Why can't I use this in a applet.

Applet error: error: java.lang.NoClassFoundDefError : java/util/ArrayList
When I dont use the Grid class in my Applet it works fine.
[ April 14, 2004: Message edited by: Mathias Nilsson ]
20 years ago