UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (Exception e) {
log.warn("Could not set the look and feel to nimbus. "
+ "Hopefully you're on a mac so the window isn't ugly as crap.");
}
TestbedModel model = new TestbedModel();
model.setWorldCreator(new WorldCreator() {
@Override
public World createWorld(Vec2 gravity) {
return new World(gravity, new DefaultWorldPool(100, 40), new BroadPhaseJNI());
}
});
final TestbedController controller =
new TestbedController(model, UpdateBehavior.UPDATE_CALLED, MouseBehavior.NORMAL,
new TestbedErrorHandler() {
@Override
public void serializationError(Exception e, String message) {
JOptionPane.showMessageDialog(null, message, "Serialization Error",
JOptionPane.ERROR_MESSAGE);
}
});
TestPanelJ2D panel = new TestPanelJ2D(model, controller);
model.setPanel(panel);
model.setDebugDraw(new DebugDrawJ2D(panel, true));
TestList.populateModel(model);
JFrame testbed = new JFrame();
testbed.setTitle("JBox2D Testbed");
testbed.setLayout(new BorderLayout());