Seems like LayoutManagers do not work for JMEDesktop

Hello,



maybe I'm to blind, but it seems that the LayoutManagers do not work for the JMEDesktop.

I'm doing something like this:



       desktop = new JMEDesktop("HUD");
        desktop.setup( display.getWidth(), 100, false, null );
        desktop.getJDesktop().setLayout(new FlowLayout());

        JLabel label1 = new JLabel();
        JLabel label2 = new JLabel();
       
        label1.setSize(display.getWidth()/2, 100);
        label2.setSize(display.getWidth()/2, 100);

        label1.setVisible(true);
        label2.setVisible(true);

        // ( fill the labels with icons / images here )

        desktop.getJDesktop().add(label1);
        desktop.getJDesktop().add(label2);



The two labels are painted onto each other.
Of course, I can manage the locations of the labels myself with JLabel.setLocation( ... ).

Question: Just not implemented yet or a little bug?

I'm not positive, but I think that has to do with you trying to put a component directly onto the JDesktop.  You might try adding a JPanel to the JDesktop and configuring a layout on the panel and adding your items to that and see if you notice a difference?



darkfrog

LayoutManagers should work. E.g. you should be able to start TestJMEDesktop and resize those internal frames to see the components in there changing positions according to frame size…

As seen in TestJMEDesktop, too. You should trigger initial layouting via the revalidate() method - maybe only that line missing?