Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 I'm trying to organize my buttons
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Neoco




PostPosted: Mon Apr 23, 2012 1:37 pm   Post subject: I'm trying to organize my buttons

Java:

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
Sponsor
Sponsor
Sponsor
sponsor
Neoco




PostPosted: Fri Apr 27, 2012 8:08 am   Post subject: Re: I'm trying to organize my buttons

Forget it you guys, I solved the problem. I used Box.createRigidArea instead of Box.createHorizontalStrut
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: