• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Scrollbar flickers after using setText()

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 :-)
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
    Posts: 12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Marshal
    Posts: 79151
    377
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I think I do need more details, please, yes.
    CR
     
    Katja Ernst
    Greenhorn
    Posts: 12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    hi, hm...what kind of details do you need?

    thanks in advance:-)
     
    Campbell Ritchie
    Marshal
    Posts: 79151
    377
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Posts: 12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Marshal
    Posts: 79151
    377
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Posts: 12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Marshal
    Posts: 79151
    377
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Posts: 12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    hi, unfortunately not...to much code. maybe i have to overwrite the paint method. hm

    thanks
     
    Campbell Ritchie
    Marshal
    Posts: 79151
    377
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Posts: 12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    hi, im sorry, i really cant post the code. is there any difference between using this in an applet or an application?

    thanks:-)
     
    Eat that pie! EAT IT! Now read this tiny ad. READ IT!
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic