Text Box

Hey all,



I made a text node which contains text. However it is completely white which resembles some problems stated on this forum with setting the classpath to the font library. However, I use netbeans and I have set the c:program filesjmejme-font.jar to the classpath and all the sources are included in the run libraries within netbeans. What am I doing wrong? It seems it cant find that bitmap (as with an earlier problem on the board).



Regards,

Frank

I saw the file is in jme.jar , however adding this to classpath still doesnt work :frowning:

Does someone know the answer to this one? :frowning:

Could you post a small test case which shows the problem?

Also make sure to updateRenderState() after adding the text to the scene.

Hiya, updateRenderState didnt work either.



Here is the code for the HUD item that creates the text:



package spacegame.hud;

import com.jme.scene.Text;
import com.jme.scene.Node;

public class SpeedGauge extends Node implements Gauge {
   
    private float value;
    private Text speedText;
           
    public SpeedGauge(){       
        speedText = new Text("Speed","Current Speed:");
        speedText.setLocalScale(1f);
        attachChild(speedText);
        updateRenderState();
    }
   
    public void setValue(float value){    
        System.out.println(value);
        speedText.print("Current Speed:" + value);               
        this.value=value;               
    }
   
    public float getValue(){
        return value;
       
    }       
}


Oh and here is the HUD initialization:



   private void initHud(){
        this.hud=new HudNode(display,"Hud Root",true);

        SpeedGauge sg = new SpeedGauge();
        hud.attachChild(sg);
       
        sg.setLocalTranslation(new Vector3f(2,10,0));
        sg.addController(new SpeedGaugeController(sg,player));

        hud.updateRenderState();
   hud.updateGeometricState(0, true);
       
        root.attachChild(hud);
       
    }

and a rootNode.updateRenderState() at the end of initHud() does not help either?

Nope, still no success :frowning:



This is how it looks in the game, on the lower left.



The Text constructor does not auto-set texture and alpha states.  Use one of the static methods Text.createDefaultTextLabel(…) or create your own texture and alpha states if you'd rather.

Thanks ! That did the trick! :slight_smile: