File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Swing, JApplet, and why do I need to resize the window for updates to show? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Swing, JApplet, and why do I need to resize the window for updates to show?" Watch "Swing, JApplet, and why do I need to resize the window for updates to show?" New topic
Author

Swing, JApplet, and why do I need to resize the window for updates to show?

Joe Vahabzadeh
Ranch Hand

Joined: Jan 05, 2005
Posts: 140
All,

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 ]
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
try this first

Joe Vahabzadeh
Ranch Hand

Joined: Jan 05, 2005
Posts: 140
Cool, that did the trick. Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Swing, JApplet, and why do I need to resize the window for updates to show?