| Author |
Scrollbar flickers after using setText()
|
Katja Ernst
Greenhorn
Joined: Dec 30, 2005
Posts: 12
|
|
hi, im using a jeditorpane to display html text. this works fine until the scrollbars are shown. the scrollbars flicker after the text is put into the editorpane using setText(). how can i avoid that? thanks :-)
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32599
|
|
Thank you for the query. It is difficult to know what to say without more details, but please consider these two questions, which might help you out: Have you got super.paintComponent(); as your first statement in your paintComponent method?Where are you calling repaint(); ? CR
|
 |
Katja Ernst
Greenhorn
Joined: Dec 30, 2005
Posts: 12
|
|
hi, im not calling repaint as it is automatically called, isnt it? i have a simple jeditorpane and a jscrollpane: JEditorPane p = new JEditorPane(); p.setContentType("text/html"); JScrollPane jsp = new JScrollPane(p); String s = "<html><body>this is sentence...</body></html>" as soon as the string s is too long to be displayed without scrolling the scrollbars are displayed and the scrollbars are flickering. do you need more details? thanks :-)
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32599
|
|
I think I do need more details, please, yes. CR
|
 |
Katja Ernst
Greenhorn
Joined: Dec 30, 2005
Posts: 12
|
|
hi, hm...what kind of details do you need? thanks in advance:-)
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32599
|
|
I have tried it myself, and it doesn't flicker. Have you included the setEditable(false) call on your JEditorPane? Try that. CR
|
 |
Katja Ernst
Greenhorn
Joined: Dec 30, 2005
Posts: 12
|
|
hi, yes, i set it using: pane.setEditable(false); so i think this is not the problem. can you post your code? thanks
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32599
|
|
It is a crude thing, with the wrong formatting; you get one button at the top and one at the bottom. Maybe if I had used GridLayout rather than Border it would have been better. You get your scroll in the middle, a button which adds the Lord's Prayer (Paternoster) to the html text, and a button which exits the whole application. You will have to get rid of the line breaks in the setText() call before you try compiling the code. [Change: There appeared to be line breaks when I posted the reply, but they disappeared when I looked at the final result, so you might not have to get rid of line breaks. ] CR [ January 02, 2006: Message edited by: Campbell Ritchie ]
|
 |
Katja Ernst
Greenhorn
Joined: Dec 30, 2005
Posts: 12
|
|
hi, hm, you were right. the scrollbars in your application dont flicker. but the scrollbars in my applet do still flicker...:-|. more ideas? thanks
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32599
|
|
Don't know. I never knew it was an Applet; are you in the correct forum? Please show us your code, so we can see the difference.
|
 |
Katja Ernst
Greenhorn
Joined: Dec 30, 2005
Posts: 12
|
|
hi, unfortunately not...to much code. maybe i have to overwrite the paint method. hm thanks
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32599
|
|
Show us your paint() and init() methods, or even "edited highlights." This is a public discussion and the idea of this forum is for us all to be able to learn from one another. We shan't do that wihtout seeing more of your code.
|
 |
Katja Ernst
Greenhorn
Joined: Dec 30, 2005
Posts: 12
|
|
hi, im sorry, i really cant post the code. is there any difference between using this in an applet or an application? thanks:-)
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: Scrollbar flickers after using setText()
|
|
|