The Java File

We would like to generate the two constructors and five methods for GtkButton.

The two constructors looks like follows:

public GtkWidget GtkButton.new();

public GtkWidget GtkButton.new(String Label);

and the five functions looks like follows:

public void GtkButton.pressed();

public void GtkButton.released();

public void GtkButton.clicked();

public void GtkButton.enter();

public void GtkButton.leave();

This means that the we want to generate a Java wrapper file that looks like this:

Example 2-2. GtkButton.java

package gtk;

public class GtkButton extends GtkContainer {
	public GtkButton()
	{
		nativepeer = nativenew()
	}
	private native long nativenew();

	public GtkButton(String label)
	{
		nativepeer = nativenewWithLabel(label);
	}
	private native long nativenewWithLabel(String label);

	native public void pressed();
	native public void released();
	native public void clicked();
	native public void enter();
	native public void leave();

}