Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Duplicate tab  RSS feed

 
Allan Sorenson
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have an application that has evolved over time. Recently we added a new tab to it. In doing so, a duplicate of the first tab now appears on some machines. I cannot replicate, but one of the testers has it happen all the time. We are using the same JVM.
This extra tab gets placed in its own row, which causes the bottom portion of the application, which the buttons are, to be obscured.
If the application is resized, the extra tab disappears.
DoubleTabBlur-2.JPG
[Thumbnail for DoubleTabBlur-2.JPG]
screen capture of double rendered tab
 
Rob Camick
Ranch Hand
Posts: 2753
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wild guesses:

a) you are overriding paint() or paintComponent() somewhere an not invoking super.paint...()

b) updates to the GUI are not being done on the Event Dispatch Thread.

c) you are adding and/or removing components but not using revalidate() and repaint() on the container.
 
Allan Sorenson
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No paint overrides.
Class extends JFrame.
bits of contructor:
 
Rob Camick
Ranch Hand
Posts: 2753
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It still looks like code is not executed on the EDT, which can cause random problems. Look at examples from the Swing tutorial on how invokeLater() is used to invoke a method "createAndShowGUI".

You also have lots of old code:

 
Allan Sorenson
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob,
Thank you very much!
It is resolved and indeed was related to the EDT.

The code building the GUI was placed in initialize() and
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
public void run() {
initialize();
}
});
placed in the constructor.

Also, thanks for pointing out the unnecessary code.
Yes, this is very old code. I update as I can, but currently I am restricted to Java 1.3.
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Allan Sorenson wrote:but currently I am restricted to Java 1.3.

That's a big problem of its own...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!