Solved

Swing JTabbedPane/Jpanel Repaint Problem

Posted on 2010-08-19
12
997 Views
Last Modified: 2013-11-23
I Have a swing application that works fine in my faster pc but behaves unexpectedly in the clients slower pc. I have verified that the jre used is same on both the machines.

My application has a topMain , centreMain and bottomMain JPanel which are inside a mainPanel which uses border layout.

topMain panel  has three other JPanels in it with labels and buttons all have layouts attached.

centreMain has a JTabbedPane which has two tabs each havinh a Jpanel which has a TableModel.

bottomMain has two buttons.

THe problem is that in the clients machine when the application is resized or moved or a native window is opened on top of the application the topPanel and bottomPanel do not repaint properly.
That is the buttons are invisible the colour of the top panel is not refreshed and I cannot see any content of the top and bottom panels either. The tabbed pane is visible though.

If I hover mouse over the bottom buttons they appear again. INterestingly as soon as I click on one of the tabs of the JtabbedPane the whole application refreshes and I can again view everything.

What can be the problem? I am not calling repaint in my code anywhere. THis code has worked for years in the same client machine and the problem has started only after I added a JTabbedPane recently. Also it works perfectly in my machine.

Any ideas on the possible cause will be appreciated. I can not paste the code unfortunately.

Thanks

The Centre Panel
0
Comment
12 Comments
 
LVL 92

Expert Comment

by:objects
ID: 33481638
any custom painting?
0
 

Author Comment

by:youneverknoweverything
ID: 33481741
No there is no custom painting, there are two cell rendereres thought that render the cells of the two tabnles inside the JTabbedPain. I doubt that this is causing the problem though.
0
 
LVL 92

Expert Comment

by:objects
ID: 33481804
easy way to check would be to comment out the renderers and see if the problem remains
0
 

Author Comment

by:youneverknoweverything
ID: 33481832
well the problem is I am unable to replicate the problem in my machine and can not bother the client all the time to test this issue. FUrther the renderers have been there since teh starting.
0
 
LVL 92

Expert Comment

by:objects
ID: 33481889
bit hard to help you without more details
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 41

Expert Comment

by:HonorGod
ID: 33483899
Wow, a very difficult to diagnose problem indeed.

If it only occurred when the client resized the window, you might consider disabling that ability,
but that has the potential of introducing some "customer annoyance" issues, not that these
don't exist already.

You indicate that you have checked the jre version on both machines.

What version is being used?
0
 

Accepted Solution

by:
youneverknoweverything earned 0 total points
ID: 33497584
Finally I was able to replicate the problem in another pc, which is using the same jre as the client pc. The only difference between my Jre is that its running in Mixed mode instead of teh shared mode that the client and the other machine is running on.

I narrowed down the problem in my renderer where I am doing a Tablecolumn.setHeight for one of the combobox columns. If I remove the setheight the problem dissapears from the client machine as well.

I think the problem has something to do with the renderer trying to set the height of the column everytime the app is resized but not being able to send a repaint after that.

I still do not understand thought that why this problem is not occuring in my pc.
0
 
LVL 92

Expert Comment

by:objects
ID: 33497630
you shouldn't be setting the height of column in your renderer (your renderer shouldn't manipulate the table at all)
0
 

Author Comment

by:youneverknoweverything
ID: 33498674
@Objects Where should I be setting the height of my table row then? My Table has a Super Type row that I want to have 30 px height because it has combobox, below the super type row there are subtype rows whoose height I want to set as 20px.
0
 
LVL 92

Expert Comment

by:objects
ID: 33498688
you should be setting the row height when you setup the table
0
 
LVL 27

Expert Comment

by:mrcoffee365
ID: 37105857
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Eclipse Neon and jdk 1.8.0 11 138
diffSum example 4 26
varialbe initialization 11 30
MySqlDump not dumping triggers 1 17
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

920 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

15 Experts available now in Live!

Get 1:1 Help Now