(a newbie question)xml can't work

I try a xml sample code and it is fine that I can understand it, but when I try to run it, I discover that the screen is all black(which means that the xml does not work.)

A big question is that where should I put the xml on?

For example:

[java]nifty.fromXml("niftygui.xml", "start");[/java]

Thanks for help

Have you read these?




I usually use a deprecated method for retriving my stuff (if on desktop).

Heres a class that I use:

[java]import java.io.File;

import java.util.ArrayList;

import start.MainGame;

import com.jme3.asset.AssetManager;

import com.jme3.asset.plugins.FileLocator;

public class IndexManager {

public static ArrayList<String> sources = new ArrayList<String>();

public static String source = “c:\path etc”;

public static void init() {

AssetManager am = MainGame.getAssetManager();

String[] locations = getSubFolders(source, “”);

for (String s : locations) {

am.registerLocator(source + s + "&quot;,FileLocator.class.getName());

System.out.println("Reading " + s);



if (locations.length < 0) {

System.out.println(“No locations found.”);



private static String[] getSubFolders(String source, String dir) {

String[] children = new File(source + dir).list();

ArrayList<String> list = new ArrayList<String>();

for (String s : children) {

if (new File(source + dir + s).isDirectory()) {

list.add(dir + s);



for (int i = 0; i < children.length; i++) {

String filename = children;

if (new File(source + dir + filename).isDirectory()) {

String[] sub = getSubFolders(source, dir + filename + "&quot;);

fillArray(list, sub);



int i = 0;

String[] subs = new String[list.size()];

for (String s : list) {

subs = s;



return subs;


private static void fillArray(ArrayList<String> list, String[] children) {

for (String s : children) {





It’s quite long. But to use it:

Simply replace the source string

and change the MainGame.getAssetManager() to your application .getAssetManager();

This way, if you have the xml in your source or in any subfolders, then all you need to do is use it’s name.

ok, I find the answer

thank you