(SOLVED) FengGui window does not want to resize (JME2)

(sorry for crossposting this also in the FengGui boards, but given the low rate of visitors there I fear no one is going to even read my message there for the next days)



I am trying to create a FengGui Window and set it to a new size, but it won't show up with the new size. Setting position, title and anything else works. Here is what I do in my init sequence of StandardGame in JME2:



fengDisplay = new org.fenggui.Display(new org.fenggui.binding.render.lwjgl.LWJGLBinding());

fengInput = new FengJMEInputHandler(fengDisplay);

GameTaskQueueManager.getManager().update( new Callable<Void>()

       {

           public Void call() throws Exception

           {

            Window frame = FengGUI.createWindow(true, true, true, true);

            fengDisplay.addWidget(frame);

          frame.setPosition(new Point(10, fengDisplay.getHeight()-50));

          frame.setSize(new Dimension(420, 420));

          frame.setTitle("Settings");

          frame.pack();

          fengDisplay.layout();

           return null;

           }

       } );



The result is that the window appears, but is very small (only 33 pixels high and 75 wide). I tried pretty much everything that came to my mind, but literally nothing had any effect on the size with which the window initially shows. I even printed the size right after the setSize command, and sure enough, it shows 420,420, instead of the 33,75 before that command. What's happening?







Perhaps related, but when I add a ComboBox like this:



co = FengGUI.createWidget(ComboBox.class);

fengDisplay.addWidget(corpusChooser);

co.setX(170);

co.setY(fengDisplay.getHeight()-100);

co.addItem("AAA");

co.addItem("BBB");



it doesn't work fully : the outlines of the Combobox show, but the innards remain of the color of the background (black in my case) and it doesn't read the first option. But sure enough, if I click on it, the PopupBox shows and shows be both options.



The fun part is - if I add it to the window created above, instead of the fengDisplay, it works as intended (after I manually resize the window to actually see it).



This is all indicates that I must be doing something wrong, but what could it be?

YourConscience said:


       frame.pack();
             fengDisplay.layout();





pack() calls setToMinSize() followed by calling layout().  Try either first calling the setMinSize() method or just calling layout instead of pack on the frame.

Thanks a lot, this was the missing puzzle piece.



What about the ComboBox?

YourConscience said:

Thanks a lot, this was the missing puzzle piece.

What about the ComboBox?


This sounds like another pack vs layout question..  Unfortunately you sometimes have to juggle the two and exactly where to call them in order to get things to display properly :|