JBotSim 1.0-beta has been released with some API changes. All examples have been updated accordingly. Please make sure you are using version 1.0 beta.

HelloWorld with JBotSim

The HelloWorld is pretty minimalist.

import jbotsim.Topology;
import jbotsimx.ui.JViewer;

public class HelloWorld{
    public static void main(String[] args){
        Topology tp = new Topology();
        new JViewer(tp);
        tp.start(); // always start the simulation last
    }
}    

You can link JBotSim as follows:

The Topology is central in JBotSim. It manages the nodes and links and performs automated tasks like initializing the message engine and updating wireless links.

The JViewer allows you to visualize the topology and interact with it in several ways. For instance, you can add nodes (left click), delete them (right click), or move them around (drag & drop) with the mouse.

Topology.start() starts the simulation. Although it can be called later (e.g. by UI button on the viewer), it is important to execute this method after your initial configurations are done.