Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java GUI
|
Java GUI Discussions specific to programming Java GUI.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java GUI section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 11th, 2007, 07:48 AM
Registered User
 
Join Date: Apr 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating CheckBox at runtime.

How to create n number of checkbox at the runtime by making use of swing in java.And when we create single checkbox each checkbox has some name to manipulate further.But if we create n checkbox is it possible to get the values from that.
 for example if we have a application say Application1 and it has 2 option read and write... and for that application it can have n number of users. how to assign them..

            Application1
           Read write

User1 yes no
user2 yes yes
user3 no no
  .
  .
  .
  .

 instead of yes or no ... i want to use checkbox and i have to store it in database.

Please can any body help in this.




Sachin
 
Old April 16th, 2007, 11:40 PM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,
Declare the check box objects as an array like

JCheckBox[] readwrite;

Get the no.of users and pass them to the constructor of the class and in that constructor instatiate the checkboxes like

readwrite = new JChechBox[noofusers];

for(int i=0;i<noofusers;i++){
         readwrite[i] = new JCheckBox("Yes", false);
}

Hope its helpful.

Regards,
Rakesh :)
 
Old April 22nd, 2007, 09:55 PM
Registered User
 
Join Date: Apr 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi rakesh,
Thanks for the reply.
Because i could not able to get the result.. i planned to make a swing table in which i kept boolean datatype ..so that i got the result of checkbox as the out put. Now another problem rised...
i.e when we connect with the database all the data from the table will be stored in a object right. now to create a table we need two things one the heading and another is two dimensional object. Heading is ok we can put the static string values. But for the Object say
Object[][] data=? we have to pass the result object of the database say result.how to do this...

Regards
Sachin

Sachin





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create runtime Checkbox button ? piscarian VB.NET 0 November 18th, 2007 08:27 PM
creating a checkbox column in a dataview badgolfer .NET Framework 2.0 0 April 27th, 2007 10:58 AM
creating checkboxes at runtime abhishekdubey_997 ASP.NET 1.0 and 1.1 Basics 14 November 24th, 2006 01:56 AM
Creating a DLL at runtime jai2k Beginning VB 6 1 January 5th, 2005 01:23 PM
Creating Access database at runtime in C# janigorse General .NET 0 September 18th, 2004 06:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.