Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-09-12
6
Medium Priority
?
195 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 1200 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
The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

 
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 800 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

688 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