(fixed) Third GUI tut problem

I am going through the gui tutorials here: http://www.jmonkeyengine.com/wiki/doku.php?id=displaying_dynamic_values_in_the_hud

On the third tutorial all I get is a pinkish square without my texture on it.  My image is 64x64 pixels.  Here is my code:


private void buildHud()
{
   // Create hud quad
   hudNode = new Node( "hudNode" );
   Quad hudQuad = new Quad( "hud", 64f, 64f );
   hudQuad.setRenderQueueMode( Renderer.QUEUE_ORTHO );

   hudQuad.setLocalTranslation( new Vector3f( DisplaySystem.getDisplaySystem().getWidth() / 2, DisplaySystem
                                    .getDisplaySystem().getHeight() / 2, 0 ) );

   // Create texture state
   TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
   ts.setTexture( TextureManager.loadTexture( getClass().getClassLoader().getResource( "hud.png" ),
                                    Texture.MM_LINEAR, Texture.FM_LINEAR, 1.0f, true) );
   
   textureWidth = ts.getTexture().getImage().getWidth();
   textureHeight = ts.getTexture().getImage().getHeight();

   //Create texture coords
   FloatBuffer texCoords = BufferUtils.createVector2Buffer( 4 );
   texCoords.put( getUForPixel( 0 ) ).put( getVForPixel( 0 ) );
   texCoords.put( getUForPixel( 0 ) ).put( getVForPixel( 40 ) );
   texCoords.put( getUForPixel( 40 ) ).put( getVForPixel( 40 ) );
   texCoords.put( getUForPixel( 40 ) ).put( getVForPixel( 0 ) );
   hudQuad.setTextureBuffer( 0, texCoords );
   hudQuad.setRenderState( ts );

   //Create alpha state
   AlphaState as = DisplaySystem.getDisplaySystem().getRenderer().createAlphaState();
   as.setBlendEnabled( true );
   as.setSrcFunction( AlphaState.SB_SRC_ALPHA );
   as.setDstFunction( AlphaState.DB_ONE_MINUS_SRC_ALPHA );
   as.setTestEnabled( false );
   as.setTestFunction( AlphaState.TF_GREATER );
   hudQuad.setRenderState( as );

   //Update render
   hudQuad.setLightCombineMode( LightState.OFF );
   hudQuad.updateRenderState();

   hudNode.attachChild( hudQuad );
   hudNode.updateRenderState();
   attachChild( hudNode );
}



That means that jME did not find the texture you addressed. You could try using the ResourceLocatorTool with its SimpleResourceLocator instead of the TextureManager directly, and you could save yourself many troubles of this type.

Ah yes that was it I forgot to put the path before the name of the texture.  I will check out the resource locater and see if I like it better than classloader's getResource().