0

I have one tab by default (tab1)
New tabs are generated , equal to 'No of rooms'.
The dynamically generated tabs have same structure as of the default tab.
I don't know the name of textfields of newly generated tabs.
How can I find the name of jtexfields generated on tab at run time so I can use .getText()

Edited by wolwayne

Attachments 2.jpg 76.64 KB 3.jpg 80.68 KB 1.jpg 68.52 KB
3
Contributors
4
Replies
17
Views
5 Years
Discussion Span
Last Post by mKorbel
0

Each tab should be created as an instance of a class, so each instance will have its own instance variable values for its own fields. Wherever you have the code to control the creation of new tabs, keep an ArrayList of those instances so you can reference them, and thus their methods and variables.

0

Sorry I forgot to add the code

int no_room = Integer.parseInt(jTextField6.getText());
for(int i = 1 ; i<no_room; i++)
{
int c = jTabbedPane5.getTabCount();
jTabbedPane5.addTab("tab "+(i+1), jTabbedPane5.getTabComponentAt(c-1));
jTabbedPane5.validate();
jTabbedPane5.repaint();
}
1

That looks like you are adding exactly the same component (not copies) to every tab - not what you want! See previous post.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.