Solved

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

Posted on 2004-09-12
6
172 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
changePi Challenge 15 77
base64 decode encode 12 98
Where to store the queries for modification of table 4 29
Java DateChooser? 2 13
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
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 theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now