Help! JEditorPane flickers!

Greetings,
I am working to display news from a web server in a JEditorPane.
I receive news from an outside source; I have an interface program to gather, parse and create a html
news file (index.html) with links to the actual news articles in it. I update this html file as soon as I receive new news articles.
Now, on the client side, I simply use the JEditorPane's setPage method to assign the index html page.
So far so good, however when the incoming news traffic is heavy, the html file is getting updated almost
every second and consequently the setPage method is getting called everys second. And needless to say
JEditorPane flickers like it has bird flu.
Is there a way to eliminate or at least reduce the flicker?
Cheers
Vic
//Simulating news a minute:
java.util.Timer timer = new java.util.Timer();
timer.schedule(new refreshNews(), 1 * 1000, 1 * 1000);
private class refreshNews extends TimerTask{
public refreshNews(){}
public void run(){
try{
pane.setPage(url);
}catch(Exception err){
err.printStackTrace();

Have you tried playing with JEditorPane's setDoubleBuffered( ) option?
This might help with the screen flicker.
Also, if you are running a separate timer thread, you should call the setPage( ) method on the Event Dispatcher thread, as Swing components are generally not thread-safe. ie.
SwingUtilities.invokeLater(new Runnable( )
  public void run( )
    // setPage call here

Similar Messages

  • Help! JEditorPane flickers! (10 Dukes)

    Greetings,
    I am working to display news from a web server in a JEditorPane.
    I receive news from an outside source; I have an interface program to gather, parse and create a html
    news file (index.html) with links to the actual news articles in it. I update this html file as soon as I receive new news articles.
    Now, on the client side, I simply use the JEditorPane's setPage method to assign the index html page.
    So far so good, however when the incoming news traffic is heavy, the html file is getting updated almost
    every second and consequently the setPage method is getting called everys second. And needless to say
    JEditorPane flickers like it has bird flu.
    Is there a way to eliminate or at least reduce the flicker?
    Cheers
    Vic
    //Simulating news a minute:
    java.util.Timer timer = new java.util.Timer();
    timer.schedule(new refreshNews(), 1 * 1000, 1 * 1000);
    private class refreshNews extends TimerTask{
    public refreshNews(){}
    public void run(){
    try{
    pane.setPage(url);
    }catch(Exception err){
    err.printStackTrace();

    Have you tried playing with JEditorPane's setDoubleBuffered( ) option?
    This might help with the screen flicker.
    Also, if you are running a separate timer thread, you should call the setPage( ) method on the Event Dispatcher thread, as Swing components are generally not thread-safe. ie.
    SwingUtilities.invokeLater(new Runnable( )
      public void run( )
        // setPage call here

  • Any help, text flickers in apps but not icons or pictures...

    I have a Ti 1 Ghz and I am starting to have problems with my display. I am not sure what the problem is as it is very strange. When I am viewing text in apps like Word, Safari, Firefox, Textedit, (basically any app), some of the text (sometimes a letter sometimes a word or sentence) gets little black dots flickering/blinking. What's weird is they move with the word instead of staying in one spot (like a dead pixel). So when I scroll the text up or down, left or right the little blinking black dot moves with the text. It also happens when I open certain pictures (moves around with the picture) but not other pictures and so far the text under icons haven't been affected.
    At first I thought maybe it is because of Tiger (I just did an upgrade - fresh install about a month ago) so I booted into OS 9 (which is on a second partition) and the same problem occurred.
    So I thought dead pixels and I ran the hardware test cd. No little dead pixels showed while testing the video.
    So I tried calibrating the display, that had no effect and it is now back at default.
    Then I tried all the different settings for smoothing/anti alaising the fonts I could. I regularly boot up in both Japanese and English (main) settings.
    So maybe drivers, so I went to the ATI website and downloaded and installed the most recent updates available.
    I even thought, hey, maybe my eyes are bad. So I asked my wife whose vision is 20/20 and she agreed it wasn't just my eys.
    Nothing has helped.
    Has anyone had a problem like this? Does any one know what is wrong? Is it my display itself or maybe the video card?
    Just a little info, I bought this PB brand new from the store and within a month the screen went pink when ever the PB was moved. So I had the displayed replaced and it hasn't had any problems since then (September 2003) until now.
    Any advice would be great.
    Thanks,
    Elfbp
    Ti 1 GHz PowerBook   Mac OS X (10.4.6)   512 MB Ram, SuperDrive

    Hi, elfbp. There is no economical way to replace the screen — and no easy way, either. It's the Powerbook's most expensive part to buy, new or used, and the hardest one to remove and install successfully. Besides, you haven't determined yet that the display is what needs to be replaced, or even that anything needs to be replaced. And the symptom you report is so very odd — anomalous pixels that follow a word or words in your text, indicating that they aren't related to particular pixels or regions in the display — that I have no idea how to go about trying to isolate the cause.
    For what it's worth, the service manual for your Tibook model contains the following video troubleshooting section. It's not directed at your particular problem, but your particular problem isn't mentioned at all, and this may suggest some useful procedures or clues:
    "No display, or dim display, but computer appears to operate correctly:
    1. Remove any connected peripherals.
    2. Make sure F1 key is not stuck down.
    3. Press the F2 key (with the fn key pressed and not pressed) to increase the screen brightness settings.
    4. Reboot the computer—hold down the Control and Command keys and press the Power button to restart the computer. Or, press and hold the Power button for 5 to 10 seconds to shut down the computer, then press the Power button to restart.
    5. Make sure using the PowerBook (1GHz/867MHz) power adapter (66-1798)
    6. Verify inverter flex cable and LVDS cable connections are seated properly and that the cables are not damaged (refer to inverter board and display module replacement instructions).
    7. Replace inverter board.
    8. Replace display assembly.
    9. Replace logic board."
    Note in particular that checking the display cable connections and replacing the inverter board are both suggested before replacing the display itself. And I would be inclined also to replace the logic board before the display, since it's less expensive and much easier to install. By the time you've replaced an inverter and a logic board, you'll be well on your way to spending what the Powerbook is worth in good condition on the current market, and replacing the display may put you over that value. This is not to say you shouldn't do it, but if you could get a comparable used Powerbook in good working order for less than you might spend fixing yours, that's at least an option worth considering.
    I have no idea what professional repair options are available to you in Japan, but if I were you, I'd look into them. Don't use any repair service that isn't Apple-authorized.
    If you want to plunge inside the Tibook yourself, complete take-apart instructions are here.

  • Can anybody help in Flickering prob in Applet

    Hi there,
    I am having problem that my applet flickers a very often . actually i have a function which call repaint on mouse over. but i wanna reduce that. If anybody can help me in this matter would be greatful.
    thank u

    If you want to call repaint() method again and again, then you should redifine update method so that it should not paint the whole background. Better solution for this type of problem is to use getGraphics() method to get a Graphics object and paint any thing as you like with this Graphics object without needing paint or repaint method.

  • Help: JEditorPane

    I use JEditorPane in my application to add html page. Also implemented HyperLink interface. But my application is not correctly displaying web page. It display content but does not display Html form feilds and also links were not activated.
    Thanks.
    Anand Pimple

    Here's how I would get the links to work
    String text = "<some html with links>"
    String contentType = "text/html";
    JEditorPane jepHTML = new JEditorPane(contentType, text);
    jepHTML.addHyperlinkListener(<some hyperlink listener>);
    Also for the HTML to disply properly, you need to make sure there aren't any meta tags in the head section for the html.... I found that JEditorPane tends to initialize the text within itself when there are meta tags in the html code.
    Also the JEditorPane only displays HTML 3.2 or less.
    I haven't run across a simple HTML4 implementation of the parser.
    Personally I'm looking for one with CSS2 support as well (preferrably a simple free one)
    BTW, if there is anyone out there that has run across a FREE simple HTML4/CSS2 parser/EditorKit foer JEditorPane, I'd really appreciate an email to [email protected]
    Hope this helps,
    and
    Thanks,
    - Ace Macleod -

  • Help: JEditorPane displays all HTML content centered

    I'm using a JEditorPane to display the contents of a simple help file written in HTML.
    The problem is that the help file is displayed with all elements centered! That is, every element is displayed as if it had the <CENTER></CENTER> tags around it. The page is not written this way, and displays normally in regular web browsers.
    It's a really simple help page, and was written by hand. I have checked, and all of the tags used in the page conform to HTML 3.2. Does anyone know what might be causing this problem?
       private JEditorPane createEditorPane()
          JEditorPane editorPane = new JEditorPane();
          editorPane.setEditable(false);
          editorPane.addHyperlinkListener(new Hyperactive());
          if (theHelpFile != null)
             try
                editorPane.setPage(theHelpFile); //This is a string, the URL to the file
             } //end try
             catch (Exception e)
                System.out.println(e.getMessage());
                System.err.println("Bad URL: " + theHelpFile);
             } //end catch
          } //end if
          else
             System.err.println("Couldn't find file: "+theHelpFile);
          } //end else
          return editorPane;
       } //end createEditorPane

    If you are using the standard HTMLEditorKit that comes along with JEditorPane, you should note that it only supports HTML 3.2. This may be the problem. Check page source if div's and similar are used or if the page has "HTML 3.2"-old elements like table's or similar to control layout/display.

  • Help! Flickering screen 20" Mac

    Hello,
    I have a 20" Mac from mid 2007 and a week ago the screen has started to flicker. The picture isn't broken at all like some of the 27" models have had, seen and read all about that.
    It's as if the brightness is continually changing from darker to lighter resulting in a flickering effect. I have tried recallibrating the screen which didn't help. A restart often helps but then it comes back after 15 minutes making me think it must be a software issue. Last update installed was an Apple security update last month but further than that nothing.
    Any suggestions? I'm gutted as it's been fabulous until now.
    Thanks engree.

    This is the MacBook forum. You should post this in the iMac user forum. https://discussions.apple.com/community/desktop_computers/imac_intel

  • Help - JEditorPane drag selected text behavior/problem

    Hi All,
    I'm working at adding new functionality to the JEditorPane. Everything was going ok, but I noticed this interesting behavior that hopefully there is a solution to.
    When you select some text in the JEditorPane with the mouse and then drag the selected text to another location, the text moves just fine. However, depeding on when you drag the text, something interesting happens.
    Here is the senerio. While the text is already selected you noticed the cursor blinking.
    (1) If you drag the selected text while the blinking cursor IS visible, the cursor will continue to blink after you drag the text to its destination.
    (2) If you drag the selected text while the blinking cursor IS NOT visible, the cursor will be invisible after you drag the text to its destination.
    So (2) is really the problem. The only way I've been able to get the cursor to start blinking again is to issue a cut, copy or paste method from the JEditorPane object.
    Has anyone else found this problem and maybe a solution to it. I've disabled all the extra stuff I extended on the JEditorPane class, but it didn't seem to make a difference.
    Thanks.
    Justin Circelli

    There are several approaches. You can add FocusListener to the drop target or drag source and put your code in focusGained() or focusLost() accordingly.
    Another way is to return focus to the drag source if DnD failed as you tried. First check whether mouseReleased(0 is invoked. If it's invoked try to put your code into SwingUtilities.invokeLater()
    regards
    Stas

  • JEditorPane inside JScrollPane flickers somethin awful

    I'm working on an instant messenger/chat application, and I've noticed that when there is 'heavy' traffic, the JEditorPane flickers quite badly. The following code demonstrates the problem:
    import javax.swing.*;
    import java.awt.*;
    public class Test extends JFrame {
      public Test() {
        JEditorPane jep = new JEditorPane("text/html", "");
        StringBuffer sb = new StringBuffer();
        JScrollPane jsp = new JScrollPane(jep);
        this.setSize(640,480);
        this.getContentPane().setLayout(new BorderLayout());
        this.getContentPane().add(jsp, BorderLayout.CENTER);
        this.setVisible(true);
        for(int i = 0; i < 200; i++) {
          sb.insert(0, i+"<br>");
          jep.setText(sb.toString());
      public static void main(String[] args) { new Test(); }
    }I'm using JEditorPane because it's easy to change I can use html tags to alter the font color/size/properties/etc.... As well, users can embed links which will then open in a browser. Is there a better way of doing this? I've tried setDoubleBuffered(true/false) on various combinations of components, using String concatenations, and setting the StringBuffer's initial length to a largish number (~5000). Nothing seems to alter the results. This problem occurs on linux and NT4 with jdks 1.3.0_002, 1.3.1, 1.4. If someone can help I'd be really grateful. I want the target jdk to be 1.3.1, so anything that came in with 1.4 isn't really an option.
    Thanks in advance,
    m

    Kurt,
    Thanks, I think that did the trick. I still have to put it into the chat app, but it works great with the test app. One thing, I do want the new text to be inserted at the top, not appended, so I changed the read statement to:
    jep.getEditorKit().read(new java.io.StringReader(i+"<br>"), doc, 0);and that throws an exception:java.lang.RuntimeException: Must insert new content into body element-
         at javax.swing.text.html.HTMLDocument$HTMLReader.generateEndsSpecsForMidInsert(HTMLDocument.java:1716)
         at javax.swing.text.html.HTMLDocument$HTMLReader.<init>(HTMLDocument.java:1692)
         at javax.swing.text.html.HTMLDocument$HTMLReader.<init>(HTMLDocument.java:1564)
         at javax.swing.text.html.HTMLDocument$HTMLReader.<init>(HTMLDocument.java:1559)
         at javax.swing.text.html.HTMLDocument.getReader(HTMLDocument.java:118)
         at javax.swing.text.html.HTMLEditorKit.read(HTMLEditorKit.java:237)
         at Test.<init>(Test.java:25)
         at Test.main(Test.java:38)but if I change position to 1 it works fine. Any explanation? The source for EditorKit says:
         * @param pos The location in the document to place the
         *   content >= 0.m

  • How to display a multiple-page html file

    My program has a multiple-page help file, which is an html file, that I would like to display page by page.
    My code presently doesn't even display anything, even though I put my "help.html" into two places, where I have my .java files and where I have my project file. Here it is:
    try
            JDialog dialog = new JDialog(AnanyaCurves.this, true);
            dialog.setTitle("Ananya Curves Help");
            JEditorPane editorPane = new JEditorPane();
            editorPane.setEditable(false);
            java.net.URL helpURL = JFrame.class.getResource("help.html");
            editorPane.setPage(helpURL);
            dialog.getContentPane().add(editorPane);
            dialog.setLocationRelativeTo(AnanyaCurves.this);
            dialog.setVisible(true);
    catch (IOException e)
    }AnanyaCurves is my main class, which extends JFrame, and the code above is the code for the method of a JMenuItem.
    Please help with my help! Thanks a lot!

    Hi,
    BrigitAnanya wrote:
    My code presently doesn't even display anything, even though I put my "help.html" into two places, where I have my .java files and where I have my project file. It has to be where the CLASS files are.
    Here it is:
    java.net.URL helpURL = JFrame.class.getResource("help.html");
    This might be in the path where the JFrame.class file is.
    You should better use
             java.net.URL helpURL = YourMainClass.class.getResource("help.html");greetings
    Axel

  • I have Photoshop CS6 problem with Win8

    I had Win7 and didn`t have any problems but I bought Win8 upgrade and I install it without any changes of my PC settings ... that was option offered from Win8 insatallation manager.
    My problem with Ps CS6 is next my files are open as a tabs and when I "move" image with hand tool  the paste board flashing from dark grey to transperant...very anoying.
    Sometimes when I "scale" image with move tool image area get black and I can`t see the image scale...
    How to fix that Please help I can`t work with normal concentration...very anoying Please help?

    Flickering is a known problem with Win8. We and the GPU vendors are working with Microsoft to get it fixed, and seeing if we can implement workarounds until the fix arrives.
    The image going dark also means a display driver problem.
    You can try turning off GPU drawing in preferences, or setting the GPU mode to basic, for the time being.

  • My Mac is doing strange things: delaying between users, mouse flickering and bouncing, gets stuck with rainbow wheel flickering. I ran the appel hardware test and it detected an error: 4MOT/4/40000003:HDD-1233 Does anybody know what that means? HELP!

    My imac is doing strange things:
    -delaying between users: when closing session it goes to blue, then takes a while to appear users signin box, and then wont recognize mouse command to enter until a couple of minutes later... then everything seems alright until....
    -it gets stuck between things, the rainbow wheel appears and its just delays there forever....
    -and every now and then the mouse starts flickering and bouncing wildly onscreen.
    I ran the appel hardware test and it detected an error:
    4MOT/4/40000003:HDD-1233
    Does anybody know what that means? HELP!

    WZZZ answered about where to get iStat. And do check the SMART status. If it is an overheating problem due to a fan or logic board problem, your hard drive is possibly cooking itself to death. If so it isn't a faulty hard drive even though the hard drive might fail. So assuming it's a temperature problem, even if you are able to repair things on the disk with software, that is working on symptoms, not causes. I could be wrong however.
    RE: AppleCare: Your iMac came with one year of AppleCare (Apple's warranty program), but within the first year you can buy 2 more years. You have to extend by the one year anniversary of purchase of the computer. Your 10,1 is too old to still be in the first year, and since you asked what it was, I'm sure you don't have it. Bottom line meaning is that whatever this problem turns out to be, you'll have to pay for it. Unless there is something like this. It is for 2011 iMacs with certain Seagate drives. You can put in your serial number for fun, but it looks like yours is too old. Lastly, some people have had Apple help them anyway if it is just out of warranty, but many have not. Your machine is one of these. Type in 10,1 in the search box. Is there an Apple Store near you? Just b/c it's out of warranty doesn't mean you shouldn't have it looked at by Apple. But no one here can say at all what Apple will or will not do.
    Hope you get it taken care of!

  • Refreshing JEditorPane (Urgent) plz help

    hello programmers,
    i'm building an html editor:
    My html editor has a split pane, the 2 pane got of the split pane are JEditorPanes, one on which i write tag and the other i display them,... thankfully all's working great, my syntax is highlighting and the html is displayed well but i've got the following problem:
    when i save a html page , i wanna my browser (on the right side of the slipt pane) to display the html page... it's ok .. it displays it with the method JHTMLEditorPane.setPage(file:/// directory/ file) but the problem is that when i save the page again using the same filename... my html page on the JHTMLEditorPane stays the same... it does not update...
    is their a refresh function for the JEditorPane? how can i update my JHTMLPane to reflect the changes i've brought to it? ONe thing , the page changes when i save it by aother file name..... PLz help it's very urgent!!!!!!!
    Bernard

    Have you tried to close and then re-open the file in your editorpane after you've saved?
    It will work when you change the name because it has to open the file as new. Java can't dynamically update values upon files like C does with pointers.

  • Please help. My facebook app will not open on my iphone 4. I deleted it,numerous times and downloaded it again. It uploads, but when you click on the icon, it flickers then closes.  Help.

    Please help. My facebook app will not open on my iphone 4. I deleted it,numerous times and downloaded it again. It uploads, but when you click on the icon, it flickers then closes.
    Help.

    Then the next step would be to restore your phone.  My advice is that prior to restoring you import your photos and videos to your computer and back up your contacts (by syncing them with iCloud or to a supported program on your computer using iTunes) as a number of users report losing these when restoring their device.

  • The screen on my MacBook has been flickering and shaking up and down. It starts flickering, shaking, gets 'pixelated,' then eventually begins to fade to white and freezes. Restarting sometimes helps, but only temporarily. Why is this? How can I fix it?

    The screen on my MacBook has just started flickering and shaking up and down while I am using it. The screen starts flickering, shaking, gets pixelated, begins to freeze, and eventually fades to white. Why is it doing this? How can I fix it?
    It is a newer MacBook, just over 1 year. It is well cared for, hasn't been dropped, etc. I don't want to pay for expensive repairs for such a new computer, and I certainly can't afford a new one!
    I've tried updating my system like the Support page suggested, but no improvement. The problem started just the other day, and is progressively getting worse.
    .... as I typed this, it did it again. Only, this time it did not flicker and shake, but got 'pixelated' (pixels came up checkered-like darkened and lightened). It did this for about 2 minutes and then stopped after I did not touch the computer.... Now it is flickering... HELP!

    it means that it is not a hardware issue.  Other then that, Im not too sure.  Sorry I can't help you any further, but Im sure others members of this forum will read your question and be able to help you.  Good luck

Maybe you are looking for

  • FTP File Sharing

    Howdy. I do produce video and audio for people. I am doing a project now where the clients dont even live in the same town or state. I would like to have a Mac Mini set up in the future where i can put the file on the hard drive and then send a link

  • Sandee mendelson reid : Oracle Error: ORA-01403

    Hi everyone!!! Please could you tell me why I get an error (ORA-01403: No data found) when executing a sql query on Oracle 8i? The query is: "INSERT INTO TABLE1 SELECT * FROM TABLE2" NB: when I run the query "SELECT * FROM TABLE2" I get property regi

  • Admin server segfaults

    I get this error message when installing under Redhat 7.3: [snip] Configuration of the Administration Server succeeded. SunONE-WebServer-Enterprise/6.0SP3 B05/14/2003 18:35 failure: server terminated (signal 11) (Interrupted system call) failure: ser

  • Transactions between Min and Max dates

    Hey all, I have a requirement to extract data between min(transdate) and max(transdate), i got to do this using a single query, i used two queries, ie. 1 select for selecting the max and min dates and my second query to get the transactions. Can some

  • Power button unpushable! Spring broken?

    So i was nonchalantly on my iPod touch(4th gen) and i went the turn it off for the night and found i couldnt press the power button! The button has collapsed into the iPod or something like the spring is broke. I dont know how old it is(older than a