Results 1 to 3 of 3
  1. #1
    ninjalord918 is offline Member
    Join Date
    Jul 2010
    Posts
    30
    Rep Power
    0

    Default How to make buttons vertical

    hello,

    The following code create 3 buttons, they all display in 1 row. How can I display them in 1 column?

    JButton calButton = new JButton("Calculate");
    calButton.setPreferredSize(new Dimension(105, 30));
    JButton predictButton = new JButton("Predict");
    predictButton.setPreferredSize(new Dimension(105, 30));
    JButton insertRowButton = new JButton("Insert Row");
    insertRowButton.setPreferredSize(new Dimension(105, 30));
    leftpane.add(calButton);
    leftpane.add(predictButton);
    leftpane.add(insertRowButton);

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,762
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by ninjalord918 View Post
    hello,

    The following code create 3 buttons, they all display in 1 row. How can I display them in 1 column?
    Maybe a GridLayout(3, 1) will do?

    kind regards,

    Jos

  3. #3
    ninjalord918 is offline Member
    Join Date
    Jul 2010
    Posts
    30
    Rep Power
    0

Similar Threads

  1. Vertical menu
    By Kligham in forum New To Java
    Replies: 13
    Last Post: 07-09-2014, 03:07 PM
  2. vertical sync
    By afraidofdark in forum Java 2D
    Replies: 0
    Last Post: 03-25-2010, 09:54 PM
  3. drawing a string vertical
    By hannes in forum Java 2D
    Replies: 2
    Last Post: 01-26-2010, 06:57 AM
  4. VERTICAL BAR GRAPH in JAVA
    By Robert_85 in forum Java 2D
    Replies: 4
    Last Post: 03-08-2009, 01:58 PM
  5. Collapsible Vertical Menu
    By ccvid in forum Java Applets
    Replies: 4
    Last Post: 01-27-2009, 06:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •