
-----------------------------------
Neoco
Mon Apr 23, 2012 1:37 pm

I'm trying to organize my buttons
-----------------------------------

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class appletsummative extends JApplet implements ActionListener
{
	Box menu = new Box (BoxLayout.Y_AXIS);
    JButton variables = new JButton ("Variables");
    JButton fractions = new JButton ("Fractions");
    JButton expanding = new JButton ("Expanding");
    JButton factoring = new JButton ("Factoring");
    
    public void init ()
    {
	setBackground (Color.lightGray);
	
	
	menu.add (Box.createHorizontalStrut (50));
	menu.add (Box.createVerticalStrut (100));
	menu.add (variables);
	menu.add (Box.createVerticalStrut (100));
	menu.add (fractions);
	menu.add (Box.createVerticalStrut (100));
	menu.add (expanding);
	menu.add (Box.createVerticalStrut (100));
	menu.add (factoring);
	
	add (menu); 
    }
}


I am trying to organize my buttons for a computer science summative. When I launch this code, I can't seem to get a fixed space between the top button and the top of my applet viewer. I need help to organize my buttons

-----------------------------------
Neoco
Fri Apr 27, 2012 8:08 am

Re: I'm trying to organize my buttons
-----------------------------------
Forget it you guys, I solved the problem. I used Box.createRigidArea instead of Box.createHorizontalStrut
