That should work :\
I tried the following little test app, it seems to happily switch between the images every time. Are you able to try this, or maybe post a test app too? Maybe that will help narrow the problem down.
[java]
import tonegod.gui.controls.buttons.ButtonAdapter;
import tonegod.gui.controls.windows.Panel;
import tonegod.gui.controls.windows.Window;
import tonegod.gui.core.Screen;
import com.jme3.app.SimpleApplication;
import com.jme3.input.event.MouseButtonEvent;
import com.jme3.math.Vector2f;
import com.jme3.renderer.RenderManager;
public class TestSetColorMap extends SimpleApplication {
//
// Change these to paths of 3 different images in your assets
//
private static final String IMAGE_1 = "Interface/bgx.jpg";
private static final String IMAGE_2 = "Interface/bgy.jpg";
private static final String IMAGE_3 = "Interface/bgz.jpg";
public static void main(String[] args) {
TestSetColorMap app = new TestSetColorMap();
app.start();
}
@Override
public void simpleInitApp() {
flyCam.setDragToRotate(true);
Screen screen = new Screen(this, "tonegod/gui/style/def/style_map.gui.xml");
screen.setUseToolTips(true);
// Preview window
final Panel imgPreviewWindow = new Panel(screen, new Vector2f(100, 100));
// Button window
Window buttonWindow = new Window(screen, new Vector2f(400, 300), new Vector2f(340, 100));
buttonWindow.getDragBar().setText("Window 1");
// Switch to image 1
ButtonAdapter b1 = new ButtonAdapter(screen, new Vector2f(20, 40), new Vector2f(100, 30)) {
@Override
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
imgPreviewWindow.setColorMap(IMAGE_1);
}
};
b1.setText("Img 1");
buttonWindow.addChild(b1);
// Switch to image 2
ButtonAdapter b2 = new ButtonAdapter(screen, new Vector2f(120, 40), new Vector2f(100, 30)) {
@Override
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
imgPreviewWindow.setColorMap(IMAGE_2);
}
};
b2.setText("Img 2");
buttonWindow.addChild(b2);
// Switch to image 3
ButtonAdapter b3 = new ButtonAdapter(screen, new Vector2f(220, 40), new Vector2f(100, 30)) {
@Override
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
imgPreviewWindow.setColorMap(IMAGE_3);
}
};
b3.setText("Img 3");
buttonWindow.addChild(b3);
screen.addElement(buttonWindow);
screen.addElement(imgPreviewWindow);
guiNode.addControl(screen);
}
@Override
public void simpleUpdate(float tpf) {
}
@Override
public void simpleRender(RenderManager rm) {
}
}
[/java]