Solved

Panels are added, but they do not appear on the applet!!

Posted on 2004-09-12
6
182 Views
Last Modified: 2010-03-31
Hey experts!

What I want from anyone of you is just to download the following Java files from this website:

http://students.aub.edu.lb/~mte01/lcfilemain.zip

These files belong to 2 programs (a server and a client); the server is run from the main function in the "TalkServer" class, and the client is run from the "Applet5" class (you can also use the html file "Applet5"); note the two programs share common files.

Run the server, and then the applet,then click on "Ind. Mat. Par Cables" in the list that shows on the left, then 4 text boxes would show; type in them "DNYA" & "1" respectively in the top two, and then again "DNYA" & "1" again in the bottom two (ignore the double quotations), then press OK, you should see an empty panel under the label "LibanCables". Go the function "drawreport2" in the Applet5 class , and see (particularly at the end of the function) how everything is added to the viewport of jScrollPane2, but amazingly nothing would appear on the screen when the applet is run!
0
Comment
Question by:mte01
  • 3
  • 2
6 Comments
 
LVL 92

Expert Comment

by:objects
ID: 12040294
try calling revalidate() after you have changed the layout.
0
 
LVL 3

Author Comment

by:mte01
ID: 12040340
It didn't solve the problem :(.... I read the documentation about revalidate, and remembered that I had such problems before, and used to solve them with setSize (which sutomatically calls revalidate), but now it seems that nothing is working.
0
 
LVL 16

Accepted Solution

by:
gnoon earned 300 total points
ID: 12040849
>and see (particularly at the end of the function) how everything is added to the viewport of jScrollPane2, but amazingly nothing would appear on the screen when the applet is run!

I think that the problem, you added everything to the viewport but only the last added component will be shown (it replaces all other components).

From the code you posted, I see you've added the scrollpane to jPanel6, so try to call jPanel6.revalidate().
(Components --> jScrollPane2 --> jPanel6 --> jSplitPane1 --> JApplet)

For another thing, you've used a lot of null layouts inside drawreport2 function, that may cause components invisible.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:mte01
ID: 12040883
Trying to validate jPanel6 didn't work either. As for removing the null layouts, I'll try that in the morning and inform you of the results because it's now 5:45 AM Beirut time, and I need to get some sleep :)

P.S.: This was CEHJ's idea to use null Layout managers instead of XYLayout managers (for controlling the coordinates of the component in a JPanel): http://www.expertsexchange.com/Programming/Programming_Languages/Java/Q_21123550.html
0
 
LVL 92

Assisted Solution

by:objects
objects earned 200 total points
ID: 12040891
Using a null layout manager is not a good idea.
And if you are forget about using revalidate() as you are totally responsible for laying out the panels in that case.
If using a null layout you need to ensure you set both the position *and* size of every component added.

I'd suggest instead using a layout manager, it'll save you lots of grief in the long run.
0
 
LVL 3

Author Comment

by:mte01
ID: 12042009
Finally!!! Problem is solved using the XYLayout layout managers instead of null ones.....thanks guys
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question