No Focused View on DrawString

X

Xiaolei Li

On my Mac OS X 10.3, I'm getting the following error on a drawString().
The code is drawing some text on a JPanel that is a part of a
JSplitPane.

"couldn't paint in Java_apple_awt_CTextPipe_doDrawString, no focused view"

This error doesn't occur on my Linux machine. I noticed that there is a
known Mac JDK bug somewhat similar to this (see below), but my error has
a noticeable effect on my application. I don't see the text being drawn
on screen unless I resize the window. Any help is much appreciated.

Q: Terminal/Console reports "Java couldn't paint in
Java_apple_awt_CRenderer_doRect, no focused view."

A: This is a known issue with Swing applications under 1.4.1 Update
1, as well as Java 1.4.1 on Panther. It specifically refers to a
failed paint call, but typically has no noticeable effect on
applications and can be safely ignored.
 
R

Roedy Green

I'm getting the following error on a drawString().
The code is drawing some text on a JPanel that is a part of a
JSplitPane.

The only place you should be calling drawString normally is in your
paint method which your never call directly!! Is that the problem?
See http://mindprod.com/jgloss/cavnvas.html for how you do this in
AWT. The only difference is you use a JPanel instead of a Canvas in
Swing.
 
X

Xiaolei Li

Roedy Green said:
The only place you should be calling drawString normally is in your
paint method which your never call directly!! Is that the problem?
See http://mindprod.com/jgloss/cavnvas.html for how you do this in
AWT. The only difference is you use a JPanel instead of a Canvas in
Swing.

Hi, yea I am only calling that in my paintComponent(Graphics g), which I
never call directly. I guess the only thing is that paintComponent()
calls another object and passes g to it. And that object uses g to
draw. I will try moving all my code into paintComponent() and see what
happens. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top