This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I've run into something of a stumbling block, no doubt due to the fact that I haven't used Swing in a while.
Anyway, I'm actually writing a small applet program, although I've also included a "main" so I can test it from the command line without a browser. Behavior both from within the browser and stand-alone are the same.
The basic premise is that I have a Border layout screen, with the PAGE_START section having a JPanel which contains a JLabel, the CENTER section has a JPanel with JLabels that get added, then the PAGE_END has two buttons, one of which is currently nonfunctional, and the other which is used to add items to the JPanel in the center section.
Program sequence is as follows:
1) Start by initializing variables, and set up the GUI 2) Fill in the items in the middle from a file 3) If the user clicks "Add", get info from the user with a JOption Pane 4) Append the new item to an existing file 5) Add the new item to the item list
Everything works except for step 5. When I add the new item to the list, it won't show unless I resize the window (or in the JApplet form, resize the browser window).
Does anyone know why this is? Is there an extra step I need to take to cause the newly added item to show up immediately without the need for resizing?
Here's the code, in a bit of rough form:
[ September 07, 2006: Message edited by: Joe Vahabzadeh ]