Solved

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

Posted on 2004-09-12
6
185 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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

Independent Software Vendors: 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!

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

739 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