0

I have a number of various components in a very large JavaEE application. As such, debugging is a pain, and sadly I cannot provide an SSCCE that accurately depicts the problem I'm having.

In a nutshell, somehow my fonts change by themselves for things like JLabels and JTabbedPanes. Without ever touching them, they're being repainted as bold, italicized, dramatically changed in size, or any combination thereof.

Simple question: why?

If I step through the Eclipse debugger, no changes are made, ever. So time is somehow a factor.

I'm still a Java grasshopper (working by myself), and haven't built this program in such a way that the EDT is a sacred object. I'm worried that because I'm potentially not making all repaint() calls on the EDT that the JTabbedPane, JLabel and other font properties are being reset and repainted.

EDIT:

Forgot to say that I'm constrained to Java 1.5.

I think I've narrowed it down to an issue with using HTML in JLabels and JTabbedPane tab titles...but past that I've got no idea. With regards to the JTabbedPane, it's going into the drawing methods with the right Font/FontMetrics objects, but for whatever reason it will very rarely (sometimes more often; still haven't figured out the timing trigger) switch up what font, style, and even size at which it's painting the text.

Jason Plank
  • 2,336
  • 5
  • 31
  • 40
BenCole
  • 2,092
  • 3
  • 17
  • 26
  • It should be OK to call `repaint()` off of the EDT, and if my memory serves me correctly, this fact is documented for this method. This doesn't smell like an EDT issue to me though as they usually cause much worse problems like your program freezing or dying. You appear to be in the discovery phase of debugging where you first must find your problem, and so I'm not sure you're at a point where we can help you yet. Keep trying to divide and conquer to try isolate the problem (unless someone smarter than me gives you a solution -- something I sincerely hope happens!). – Hovercraft Full Of Eels Mar 09 '12 at 22:48
  • 1
    What look and feel are you using? – Adam Mar 09 '12 at 22:48
  • 2
    It is likely that trying to provide an SSCCE will actually guide you to what you are doing wrong and debug your issue. Btw, calling repaint() outside the EDT is not an issue. – Guillaume Polet Mar 09 '12 at 22:49
  • 1
    Are you ever intentionally changing the `Font` of your components? – Jeffrey Mar 09 '12 at 23:02
  • 1
    You might look for [_adventitious JARs_](http://stackoverflow.com/a/3432254/230513); also look for spurious calls to `setUI()`, sometimes mistakenly used as a substitute for `repaint()`, _et al_. – trashgod Mar 09 '12 at 23:07
  • I'm using one of the `OfficeLnF` Look and Feels, and it's set right before the main program starts. I do change the `Font` of components, but only once, when they're initialized. Also, I'm not using a Mac; not sure if adventitious JARs are still and issue? – BenCole Mar 09 '12 at 23:53
  • Yes, all platforms have the standard directory property names, although each platform has its own list of paths for a given property. You may have multiple copies of the `OfficeLnF`. – trashgod Mar 10 '12 at 02:57
  • edited Q to include a little more info. – BenCole Mar 12 '12 at 18:37

0 Answers0