Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Creating new Objects in loop - Java

Reply
Thread Tools

Creating new Objects in loop - Java

 
 
Arans Arans is offline
Junior Member
Join Date: Dec 2011
Posts: 1
 
      12-14-2011
Hi All,

Possibly this is a repeat thread, but help on this.

I need to create new instance of JRadioButton within loop uniquly which I can refer in a program.

Here's the snapshot

JRadioButton className1 = new JRadioButton("test1");
className.setMnemonic(KeyEvent.VK_A);
className.setActionCommand("test1");
className.setSelected(true);

JRadioButton className2 = new JRadioButton("test2");
className.setMnemonic(KeyEvent.VK_B);
className.setActionCommand("test2");
className.setSelected(true);

JRadioButton className3 = new JRadioButton("test3");
className.setMnemonic(KeyEvent.VK_C);
className.setActionCommand("test3");
className.setSelected(true);

the object should be instantiated dynamically with the values retrieved from loop and this dynamic object, I should be able to use it anywhere in the program for further use.

Any help will be appreciated, Thanks in advance
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Triple nested loop python (While loop insde of for loop inside ofwhile loop) Isaac Won Python 9 03-04-2013 10:08 AM
Creating Class Objects in Loop Fish Python 3 03-31-2008 03:51 PM
class objects, method objects, function objects 7stud Python 11 03-20-2007 06:05 PM
Creating new objects in for loop nemrac98@gmail.com Java 7 11-04-2005 02:24 PM
JRuby: How does one keep Java objects as Java objects so they can be used in method calls? Steve Drach Ruby 3 06-19-2004 11:25 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57