Can any one tell me what is xlets and a simple program (with xlets and java) and what all the softwares required to run.
Xlets are for the Java ME platform for embedded devices. This link may help
Netbeans allows you to run the application from your PC.
A copy and paste from the link :
package helloxlet;
import javax.microedition.xlet.*;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Font;
// Create the Main class.
public class Main extends Component implements Xlet {
private Container rootContainer;
private Font font;
// Initialize the xlet.
public void initXlet(XletContext context) {
log("initXlet called");
// Setup the default container
// This is similar to standard JDK programming,
// except you need to get the container first.
// XletContext.getContainer gets the parent
// container for the Xlet to put its AWT components in.
// and location is arbitrary, so needs to be set.
// Calling setVisible(true) make the container visible.
try {
rootContainer = context.getContainer();
rootContainer.setSize(400, 300);
rootContainer.setLayout(new BorderLayout());
rootContainer.setLocation(0, 0);
rootContainer.add("North", this);
rootContainer.validate();
font = new Font("SansSerif", Font.BOLD, 20);
} catch (Exception e) {
e.printStackTrace();
}
}
// Start the xlet.
public void startXlet() {
log("startXlet called");
//make the container visible
rootContainer.setVisible(true);
}
// Pause the xlet
public void pauseXlet() {
log("pauseXlet called");
//make the container invisible
rootContainer.setVisible(false);
}
// Destroy the xlet
public void destroyXlet(boolean unconditional) {
log("destroyXlet called");
//some cleanup for the xlet..
rootContainer.remove(this);
}
void log(String s) {
System.out.println("SimpleXlet: " + s);
}
public void paint(Graphics g) {
int w = getSize().width;
int h = getSize().height;
g.setColor(Color.blue);
g.fill3DRect(0, 0, w - 1, h - 1, true);
g.setColor(Color.white);
g.setFont(font);
g.drawString("Hello Java World", 20, 150);
}
public Dimension getMinimumSize() {
return new Dimension(400, 300);
}
public Dimension getPreferredSize() {
return getMinimumSize();
}
}