Most codes in WIKI aren't working for me


Exception in thread "main" java.lang.Error: Unresolved compilation problem:

   at com.jme.app.TestProgressBar.main(TestProgressBar.java:89)




I'm trying that code, but I get that error. I get that for about every single code I run. I was able to run most of the Hello examples. Why can't I run any thing else?

Here is the code directly from what's in the wiki:


package com.jme.app;

import java.util.logging.Level;
import java.util.logging.Logger;
 
import com.jme.app.SimpleGame;
import com.jme.renderer.Renderer;
import com.jme.scene.Node;
import com.jme.scene.Spatial;
import com.jme.scene.state.LightState;
 
/**
 * Simple Demo Class for the ProgressBar.
 */
public class TestProgressBar extends SimpleGame {
    private ProgressBar progressBar;
    private Node guiNode;
    private int gauge;
    private int gaugeChangeValue;
    private float lastUpdate;
   
    /**
     * Init the Progressbar:
     * - Position on Screen
     * - Min / Max Values for the Gauge
     */
    protected void simpleInitGame() {
        gaugeChangeValue = 10;
        progressBar = new ProgressBar(display);
        progressBar.setMinimum(0);
        progressBar.setMaximum(1000);
        progressBar.setScale((display.getWidth() / 150),
                (display.getHeight() / 175));
        // position the progressbar in the lower left corner
        progressBar.setPosition(progressBar.getWidth(), progressBar.getHeight()+50);
        progressBar.setGauge(gauge);
        buildHUD();
    }
   
    /**
     * create a GUI Node to attach the PrograssBar to.
     */
    private void buildHUD() {
        guiNode = new Node("gui swing");
        // Render the Gui node in the Ortho Queue
        guiNode.setRenderQueueMode(Renderer.QUEUE_ORTHO);
        // attach the ProgressBars node to the GuiNode
        guiNode.attachChild(progressBar.getNode());
        // don't cull the gui away
        guiNode.setCullMode(Spatial.CULL_NEVER);
        // gui needs no lighting
        guiNode.setLightCombineMode(LightState.OFF);
        // update the render states (especially the texture state of the ProgressBar!)
        guiNode.updateRenderState();
        // update the world vectors (needed as we have altered local translation
        // of the desktop and it's
        // not called in the update loop)
        guiNode.updateGeometricState(0, true);
    }
 
    /**
     * Render the GuiNode.
     * Notice that the GUI Node was not attached to the RootNode.
     */
    @Override
    protected void simpleRender() {
        display.getRenderer().draw(guiNode);
    }
   
    /**
     * Update the Progressbar Gauge
     */
    @Override
    protected void simpleUpdate() {
        if (timer.getTimeInSeconds() > lastUpdate + 0.1f) {
            gauge += gaugeChangeValue;
            if (gauge >= progressBar.getMaximum() ||
                gauge <= progressBar.getMinimum()) {
                gaugeChangeValue *= -1;
            }
            lastUpdate = timer.getTimeInSeconds();
        }
        progressBar.setGauge(gauge);
    }
   
    /**
     * Entry point.
     */
    public static void main(String[] args) {
        // We don't want to see Info Messages
        Logger.getLogger("com.jme").setLevel(Level.WARNING);
        new TestProgressBar().start();
    }
   
}




I'm using Eclipse and I have installed every thing it said too.


Also any thing I try to run, to make it show the props dialog does this:


Exception in thread "main" java.lang.Error: Unresolved compilation problem:
   ALWAYS_SHOW_PROPS_DIALOG cannot be resolved

   at Lesson2.main(Lesson2.java:45)

If your code has a reference to NEVER_SHOW_PROPS_DIALOG, and it compiles, you have jME1, not jME2.  In jME2, the comparable line would be:


app.setConfigShowMode(ConfigShowMode.NeverShow, Lesson2.class.getClassLoader()
            .getResource("jmetest/data/images/FlagRush.png"));


java.lang.Error: Unresolved compilation problems:
   Texture.MM_LINEAR_LINEAR cannot be resolved
   Texture.FM_LINEAR cannot be resolved

   at Lesson1.simpleInitGame(Lesson1.java:46)
   at com.jme.app.BaseSimpleGame.initGame(BaseSimpleGame.java:544)
   at com.jme.app.BaseGame.start(BaseGame.java:74)
   at Lesson1.main(Lesson1.java:27)




:l...

Fixed the other problem now I get that.



Texture.MM_LINEAR_LINEAR,
                      Texture.FM_LINEAR);




That's what's in there.


And I also changed it to jME2's code:


Texture.MinificationFilter.Trilinear;
                      Texture.MagnificationFilter.Bilinear;

Well the example code is for jME 1. Quite possibly you have set up the newer jME 2. All the tutorials have not been updated to reflect jME 2 yet.



You can still make use of them by keeping track of changes made when moving from jme 1 to jme 2. Just follow this page, replace some code and you should be fine. If you still run into trouble, post the error messages you get, or the classes that cannot be resolved on the forum… and we will try to add the missing information to the list of changes.

Mindgamer said:

Well the example code is for jME 1. Quite possibly you have set up the newer jME 2. All the tutorials have not been updated to reflect jME 2 yet.

You can still make use of them by keeping track of changes made when moving from jme 1 to jme 2. Just follow this page, replace some code and you should be fine. If you still run into trouble, post the error messages you get, or the classes that cannot be resolved on the forum.. and we will try to add the missing information to the list of changes.



Thanks :), I updated my post, what about the props error?


app.setDialogBehaviour(NEVER_SHOW_PROPS_DIALOG, Lesson2.class.getClassLoader()
            .getResource("jmetest/data/images/FlagRush.png"));



That's the code I'm using and I am using jME2