Results 1 to 4 of 4
  1. #1
    okabeer is offline Member
    Join Date
    Apr 2009
    Posts
    15
    Rep Power
    0

    Default combo box help... plus hi this is my first post

    hello everyone this is my first post....

    i wrote this code done to display multi combocheckboxes however it displays only the last one.
    ------------------
    package jst;
    import javax.swing.*;
    public class checkb {
    public static void main(String[] args) {
    JFrame frame= new JFrame("CBox");
    JCheckBox chk1 = new JCheckBox("nash 13");
    JCheckBox chk2 = new JCheckBox("wade 3");
    JCheckBox chk3 = new JCheckBox("jame 23");
    JCheckBox chk4 = new JCheckBox("stoudemire 1");
    JCheckBox chk5 = new JCheckBox("howard 12");
    frame.add(chk1);
    frame.add(chk2);
    frame.add(chk3);
    frame.add(chk4);
    frame.add(chk5);
    frame.setSize(400,200);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
    frame.setVisible(true);
    }
    }

  2. #2
    faisalcmpm is offline Member
    Join Date
    Feb 2009
    Posts
    22
    Rep Power
    0

    Default

    The code pasted here will give you a screen with multi checkboxes , not multi combocheckboxes.
    As you have not defined any layout, all check boxed are clubbed at the centre and the it displays the one which u have added last.

  3. #3
    okabeer is offline Member
    Join Date
    Apr 2009
    Posts
    15
    Rep Power
    0

    Default

    oh so they r like on top of each other and so i cant see them... is there a commond to place them specifically on my screen.. thank you... i just started teaching myself jswing

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    You need to read up on using the different Swing layout managers. For example here, you'd probably want to use a JPanel that uses GridLayout to hold the check boxes. Look here: Layout Manager Tutorials

Similar Threads

  1. Combo Box Population
    By barusk in forum Java Applets
    Replies: 1
    Last Post: 03-20-2009, 02:48 PM
  2. creation of one combo box form another combo box
    By er.tyagigaurav in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 12-09-2008, 04:14 PM
  3. graph + combo box
    By abelah in forum New To Java
    Replies: 7
    Last Post: 10-13-2008, 06:36 PM
  4. How to place a combo box in a tool bar
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-02-2008, 09:09 PM

Posting Permissions

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