Ahot's weblog

Thursday Sep 13, 2007

Do you know that you can call Java-Applet-public-methods from JavaScript?
I don't really know how you can use it, but it works.
For example, you have applet:
import javax.swing.JApplet;
import javax.swing.JLabel;

public class TestApplet extends JApplet {
	JLabel lbl;
	public void setLabelText(String text) {
		lbl.setText(text);
	}
	public void init() {
		lbl = new JLabel("This is java-applet");
		this.getContentPane().add(lbl);
	}
	
}
If you want to change text in applet with javascript, you can use code:
<APPLET code="TestApplet.class" width=240 height=40 id="myapplet"></APPLET>
<FORM>
<INPUT TYPE="text" value="Enter text here" id="myTextField"> 
<INPUT type=button value="Insert to applet" onclick="CallAppletMethod()">
<SCRIPT>
function CallAppletMethod() {
	var myApplet = document.getElementById('myapplet'); 
	var myParam = document.getElementById('myTextField').value;
	myApplet.setLabelText(myParam); //just call java-method, it's easy :)
}
</SCRIPT>

Working sample is inside. [Read More]

Monday Sep 10, 2007

During two-games developing I have found one useful solution.
It's nested-clocks - simple java-class for managing of time-threads.
Main idea is that if you pause clock then all children clocks will be paused too.
Source code is inside. [Read More]

Friday Sep 07, 2007

Here I want to finish making ShiftIt.
Hope you like it. I like :)
So download it here and have fun.
What is new:
- added time bonus;
- changed design of game enviroment;
- fixed some bugs.

Screens:


Tuesday Sep 04, 2007

This is my first experience in JavaME. ShiftIt works on JavaME devices now.
Device should have: CLDC-1.1 and MIDP-2.0. Most of cellular-phones support them.

You can download it here (50K).

Tuesday Aug 07, 2007

Here is my new game. It's has no sound and good graphics.
But I hope you find it interesting.
Screen:

Click "Read more" to play.

[Read More]
Total entries: 39 >>

FEEDS:

BOOKMARKS:

This blog copyright 2009 by ahot