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 February 20th, 2010, 02:59 PM
Registered User
 
Join Date: Feb 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamically adding a panel to an existing panel?

I have a program where I have several tabs(JTabbedPane). On the second tab, there is a top panel that has three small panels inside of it. One of which is to be populated by several smaller panels at runtime when the user clicks import.
So basically, when the user clicks import from the menu, the list panel that is in the top panel of the second JTabbedPane should automatically be populated with smalled panels dynamically. Each of the small panels has like three labels and two button. The problem I am having is that when I iterate and add the small panels to the list panel, they do not show up. I know they are being crated correctly because I can add them as new tabs with ease and the iteration and construction is correct. They just won't appear in the already existing list panel.

This code works and produces new tabs with the small panels in them:

public void importCurAbsUC(EditUseCasePanel ucEditer, UseCaseGUI gui){
this.useCases = UseCaseModel.getUseCaseVector();
System.out.print("inside import call\n");
for (Iterator<UseCaseStruct> it = useCases.iterator(); it.hasNext();){
tempUseCase = it.next();
//ucEditer.getAbsListUCPanel().add(new absUCPanel(tempUseCase.getActor(), tempUseCase.getSystem(), tempUseCase.getVNPhrase()));
//ucEditer.getAbsListUCPanel().repaint();
gui.getjTabbedPane1().add("abstract UC", new absUCPanel(tempUseCase.getActor(), tempUseCase.getSystem(), tempUseCase.getVNPhrase()));
//gui.getjTabbedPane1().repaint();
System.out.print(tempUseCase.getVNPhrase()+ " panel was made and added\n");
}
}




But this code does not work, the code i want to work:
public void importCurAbsUC(EditUseCasePanel ucEditer, UseCaseGUI gui){
this.useCases = UseCaseModel.getUseCaseVector();
System.out.print("inside import call\n");
for (Iterator<UseCaseStruct> it = useCases.iterator(); it.hasNext();){
tempUseCase = it.next();
ucEditer.getAbsListUCPanel().add(new absUCPanel(tempUseCase.getActor(), tempUseCase.getSystem(), tempUseCase.getVNPhrase()));
//ucEditer.getAbsListUCPanel().repaint();
//gui.getjTabbedPane1().add("abstract UC", new absUCPanel(tempUseCase.getActor(), tempUseCase.getSystem(), tempUseCase.getVNPhrase()));
//gui.getjTabbedPane1().repaint();
System.out.print(tempUseCase.getVNPhrase()+ " panel was made and added\n");
}
}


Thanks in advance for any help.

Last edited by Thorshix; February 20th, 2010 at 03:01 PM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a Panel control in FormView steve35719 ASP.NET 2.0 Basics 5 August 18th, 2010 12:32 AM
how 2 make cursor persistent while adding table into the update panel jack_hilary BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 12 September 23rd, 2009 01:17 PM
Dynamically added panel with radio buttons ADM10 Visual Basic 2005 Basics 1 May 11th, 2006 10:27 PM
ViewState problem when adding a panel to a panel koekie17 C# 3 February 20th, 2006 09:17 AM





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