This site requires JavaScript, please enable it in your browser!
Greenfoot back
JasonZhu
JasonZhu wrote ...

2014/6/11

Better Layout for my GUI

JasonZhu JasonZhu

2014/6/11

#
Currently my GUI for my solitary game looks like so: and is laid out by the given code:
public class ElevensGUI extends JFrame
{
    private Layout layout;
    private ControlPanel panel;

    public ElevensGUI()
    {
        setLayout(new FlowLayout());
        setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
        
        layout = new Layout();
        add(layout);

        panel = new ControlPanel(layout);
        add(panel);
        
        setSize(1100,250);
        setTitle("Elevens");
        setVisible(true);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
    }
}
The problem with this is that when I begin to get down to the last cards, the control panel shifts positions. It ends up like this: Is there a simple way to fix this?
danpost danpost

2014/6/11

#
You need to make a higher level component that is top-down containing two lower level components -- one with the cards that is left to right and one with the control panel which is left to right.
You need to login to post a reply.