Computer Science Canada

Using the Box class

Author:  Neoco [ Sat May 19, 2012 3:09 pm ]
Post subject:  Using the Box class

I'm still working on my computer science summative and now I need help with shifting my components downward

summative:

import java.awt.*;
import javax.swing.*;

public class conceptstemplate extends JApplet
{
        Box sidebar = new Box (BoxLayout.LINE_AXIS);
       
        JButton next = new JButton ("Next >");
        JButton previous = new JButton ("< Previous");
        JButton mmenu = new JButton ("Main Menu");
       
        public void init ()
        {
                setSize (1000, 600);
                setBackground (Color.lightGray);
               
               
                //sidebar.add (Box.createRigidArea (new Dimension (50, 450)));
                //sidebar.add (Box.createVerticalStrut (450));
                //sidebar.setBounds (0, 450, getWidth (), 150);
                //sidebar.add (Box.createHorizontalGlue ());
               
                sidebar.add (Box.createHorizontalStrut (50));
                sidebar.add (mmenu);
                sidebar.add (Box.createHorizontalStrut (600));
                sidebar.add (previous);
                sidebar.add (Box.createHorizontalStrut (50));
                sidebar.add (next);
               
                add (sidebar);
        }
}


This is supposed to create a few buttons at the bottom of the screen. What I'm having trouble with is shifting these buttons to the bottom of the screen. The methods with the "//" next to them are the methods I have tried using and that haven't worked. Help please?


: