Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-07-2007, 11:06 AM
Member
 
Join Date: Nov 2007
Posts: 15
kureikougaiji is on a distinguished road
GUI problem...
how can i make checkBoxes that is dependent to an input...???
like for example, if a user types in 4, my java system will make 4 check boxes... please help... thanks..
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-07-2007, 11:30 AM
Member
 
Join Date: Nov 2007
Posts: 15
kureikougaiji is on a distinguished road
hmm...
can somebody help me please????
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 12-07-2007, 11:35 AM
Member
 
Join Date: Nov 2007
Posts: 15
kureikougaiji is on a distinguished road
hayyyy...
i need this as soon as possible... please... somebody......T_T
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 12-07-2007, 01:00 PM
Member
 
Join Date: Aug 2007
Posts: 22
revathi17 is on a distinguished road
you can start from something like this:

Code:
import java.awt.BorderLayout; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; public class UserInput extends JPanel{ JPanel checkBoxPanel = new JPanel(); public UserInput(){ int noOfCBReq = Integer.parseInt( JOptionPane.showInputDialog("Enter the number of check boxes needed")); JCheckBox[] cb = new JCheckBox[noOfCBReq]; for(int i=0; i<cb.length; i++){ JCheckBox checkBox = new JCheckBox(); checkBox.setText("Check box"+i); checkBoxPanel.add(checkBox); } add(checkBoxPanel, BorderLayout.CENTER); } public static void main(String[] args){ JFrame f = new JFrame("User Input test"); f.getContentPane().add(new UserInput()); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); f.setVisible(true); } }
Hope this helps
-R
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 12-07-2007, 01:04 PM
Member
 
Join Date: Aug 2007
Posts: 22
revathi17 is on a distinguished road
The other way would be to add a Textfield and a JButton. Make the user enter the number of check boxes in the text field and add a ActionListener to the JButton. Create checkboxes in the actionPerformed method of the listener.
Depends on what you want in the GUI...


-R
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 12-11-2007, 05:22 AM
Member
 
Join Date: Nov 2007
Posts: 15
kureikougaiji is on a distinguished road
ok...
thanks!! very much appreciated...
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +3. The time now is 03:55 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org