FengGui OpenGl Exceptions

Hello



When expanding the jme - FengGui example on the wiki ( http://www.jmonkeyengine.com/wiki/doku.php?id=simple_fenggui_jme_app )

with a TextArea or some other widgets i get the following exception:


21.01.2007 23:57:43 com.jme.scene.Node attachChild
INFO: Child (The Box) attached to this node (rootNode)
org.lwjgl.opengl.OpenGLException: Invalid value (1281)
        at org.lwjgl.opengl.Util.checkGLError(Util.java:56)
        at org.lwjgl.opengl.Display.swapBuffers(Display.java:567)
        at org.lwjgl.opengl.Display.update(Display.java:583)
        at com.jme.renderer.lwjgl.LWJGLRenderer.displayBackBuffer(Unknown Source)
        at com.jme.app.BaseGame.start(Unknown Source)
        at jmeUtil.FengJME.main(FengJME.java:263)
21.01.2007 23:57:44 com.jme.app.BaseGame start
INFO: Application ending.



other widgets like the MessageBox work well

I'm running on ubuntu 6.10 with jdk 1.5 or 1.6
jme is todays cvs with FengGui 2006-12-31

My customized initGui() method:


   protected void initGUI()
   {
      // Grab a display using an LWJGL binding
      //   (obviously, since jME uses LWJGL)
      disp = new org.fenggui.Display(new org.fenggui.render.lwjgl.LWJGLBinding());
      
      input = new FengJMEInputHandler(disp);
      
      // Create a dialog and set it to some location on the screen
      Window frame = new Window();
      disp.addWidget(frame);
                frame.setX(20);
                frame.setY(350);
                frame.setSize(200, 100);
                frame.setShrinkable(false);
                //frame.setExpandable(true);
                frame.setTitle("Woehl a Foarb...");
                frame.getContentContainer().setLayoutManager(new StaticLayout());
               
                // Create a combobox with some random values in it
                //   we'll change these values to something more useful later on.
                ComboBox<String> list = new ComboBox<String>();
                frame.addWidget(list);
                list.setSize(150, list.getMinHeight());
                list.setShrinkable(false);
                list.setX(25);
                list.setY(25);
                list.addItem("White");
                list.addItem("Green");
                list.addItem("Blue");
                list.addItem("Red");
              
                list.getPopupList().getToggableWidgetGroup().addSelectionChangedListener(new CBListener());
     
                //try to add TextArea here but get OpenGLException
                TextArea ta = new TextArea(false);
                disp.addWidget(ta);
                ta.setText("Hallo Text");
                ta.setX(240);
                ta.setY(350);
                ta.setShrinkable(false);
               
                // Update the display with the newly added components
                disp.layout();
   }



Any ideas, FengGui'ers ?

Hi,



First of all thanks to Whackjack for pointing me to this post.



You discovered a bug that has to do with sizes set to zero. Setting a size (EDIT: greater than zero) on TextArea solves that problem. E.g. do ta.setSize(100, 30); in your example. However, TextArea is actually a composed widget out of a TextEditor and a ScrollContainer. So if you actually only want a a text field that has one line (like JTextField in Swing), I recommend to use TextEditor directly. Your code would then looke like:


TextEditor ta = new TextEditor(false);
                   disp.addWidget(ta);
                   ta.setText("Hallo Text");
                   ta.setX(40);
                   ta.setY(50);
                   ta.setSizeToMinSize();



I hope this helps?

Cheers! Johannes

Hello Schabby



Thank You and Whackjack for the fast and detailed response and hint.

I'll test Your suggestion when i get home today but have no doubt it will solve my problem.



I'm trying FengGui the first time and must say that i find the examples quite impressive  :slight_smile:








Thanks! I am glad you like it. As soon as we are done with the new XML-theme-loader, we will "reanimate" the old themes to further spice it up.



Johannes