How to make JScrollPane scroll faster?

Hi,
I have tried to develop on a program to zoom in or zoom out the image�a graph which is plotted using the method draw from Graphics2D. In the program, I am given about 1000 points, which are supposed to be plotted one by one suing the draw method, which later form a graph.
I have put the JPanel, where the output of the graph is displayed, into a JscrollPane to enable scrolling of large image. However, when I am trying to scroll the image, it happen to me that the scrolling is extremely slow. When I click at the scrolling bar to scroll down the image, it take some time before the image is scrolled down.
My doubt will be is there any method to make the scrolling on the JscrollPane to become faster?does this involve double buffering?
Thank you.

This may not be the answer to your problem, but I thought I would throw it out there. One reason it might scroll slowly is because by default the JScrollPane only moves 1 pixel for every click of the scroll bar. You can adjust this by having your JPanel implement the Scrollable interface.
Here is a code sample -
// implement Scrollable interface
public Dimension getPreferredScrollableViewportSize()
return getPreferredSize();
public int getScrollableBlockIncrement( Rectangle r, int orientation, int direction )
return 10;
public boolean getScrollableTracksViewportHeight()
return false;
public boolean getScrollableTracksViewportWidth()
return false;
public int getScrollableUnitIncrement( Rectangle r, int orientation, int direction )
return 10;
Whatever number you have your getScrollableUnitIncrement and getScrollableBlockIncrement methods return is how many pixels your component will scroll for each click of the scroll bar.
Give this a try.

Similar Messages

  • How to make JScrollpane not to fetch data while scrollbar is adjusting?

    how to make JScrollpane not to fetch data while scrollbar is adjusting?
    Hi,
    I need to make the jscrollpane get data only when the scrollbar stops scrolling.
    for instance if I hold the scrollbar's thumb and drag it to pass 1000 records, I want the view to wait until I release the thumb before taking any action( ex. adjust the view). in other words if the value of getValueIsAdjusting() of scrollbar is true, then the jscrollpsne should wait until it changes to false before doing anything. this is the same approach that Outlook takes when browsing through the list of emails in your mailbox.
    I don't know how to solve this issue. any help regarding this issue would be appreciated.
    thanks
    Saba

    You are planning to mention your cross-post(s) somewhere in this post, correct?

  • How to make slow reports fast?

    Hi all,
    How to make slow reports fast? What could be the various reasons and optimizations/solutions?
    Thanks,
    Charles.
    ++++++++++++++++++++++++++++++

    Its an on going process. Couple of steps you will have to follow: Did you perform any SQL trace ..?
            Did you perform any ABAP trace...?
            How much business data these reports are processing.Is there a possibility you can do some changes.
    SQL Trace ( SAP in built tool) will give you a fair idea about each and every SQL statements in your report. And you can anlyze bad ones. And also propse optimized SQL or
    index if needed.
    ABAP Trace(SAP in bulit tool), you can find out amount of ABAP run time thats being elapsed by each and individual abap module.
    Also the amount of business data is every  important. While designing the report alogorithm this is very important factor.

  • Flash cs3: how to make moving/scrolling photo menu left and right?

    http://media.moma.org/subsites/2008/miro/flashsite/index.html
    - click continue, then relative size link
    How can I do this with lash cs3: how to make moving/scrolling
    photo menu left and right?
    When you move left and right and paintings move. and when you
    click on a painting, you see the the title and it links to another
    page on the site.

    scene_mc start at x = -550... x wide is 2164 px
    now I have this and its working...
    navL_mc.addEventListener(MouseEvent.MOUSE_OVER, navL_Over);
    navL_mc.addEventListener(MouseEvent.MOUSE_OUT, navL_Out);
    function navL_Over(e:MouseEvent){
              if(scena_mc.x == 0){
                                  scena_mc.x == 0;
              else if(scena_mc.x <= -10){
                                  scena_mc.x += 10;
                                  navL_mc.addEventListener(Event.ENTER_FRAME, runL);
    function runL(e:Event):void{
              if(scena_mc.x == 0){
                                  scena_mc.x == 0;
              else if(scena_mc.x <= -10){
                                  scena_mc.x += 10;
    function navL_Out(e:MouseEvent){
              navL_mc.removeEventListener(Event.ENTER_FRAME, runL);
    navR_mc.addEventListener(MouseEvent.MOUSE_OVER, navR_Over);
    navR_mc.addEventListener(MouseEvent.MOUSE_OUT, navR_Out);
    function navR_Over(e:MouseEvent){
              if(scena_mc.x == -1164){
                                  scena_mc.x == -1164;
              else if(scena_mc.x >= -1154){
                                  scena_mc.x -= 10;
                                  navR_mc.addEventListener(Event.ENTER_FRAME, runR);
    function runR(e:Event):void{
              if(scena_mc.x == -1164){
                                  scena_mc.x == -1164;
              else if(scena_mc.x >= -1154){
                                  scena_mc.x -= 10;
    function navR_Out(e:MouseEvent){
              navR_mc.removeEventListener(Event.ENTER_FRAME, runR);

  • How to make a scroll bar!!!

    i need to know how to make a scroll bar in flash cs3! can
    anyone help me with this??

    http://learnola.com/2008/10/27/flash-tutorial-create-a-custom-scrollbar-with-actionscript/

  • How to make a scroll animation constantly fixed after scrolling? I want the animation to Start when I scroll down, but I don't want the animated thing to disappear when I scroll up again.

    How to make a scroll animation constantly fixed after scrolling? I want the animation to Start when I scroll down, but I don't want the animated thing to disappear when I scroll up again.
    I know how to start the animation by scrolling down, but I simply want it to stay there after it. Could you help me please, guys?

    Hi Tom,
    There is no native feature in Muse to achieve this.
    Regards,
    Aish

  • I have 10 UiWebView to load different charts and maps on an iPad,using UIScrollView to scroll through each page, problem is on loading of each UiWebView my UiScrollView does not scroll smoothly to other pages horizontally,so how to make the scroll smooth?

    I have 8-10 UiWebView's  to load different charts and maps on an iPad, i am using UIScrollView to scroll through each page, problem is while loading of each UiWebView my UiScrollView does not scroll smoothly to other pages horizontally, my query is can i load UiWebView on background and how to make sure the scoll of pages is smooth, even though the loading of UiWebViews may take time.
    Note :i have tried disabled scrolling on webview, so when i scroll on the page  the scroll event will be of UiScrollView, so believe no conflict with UiWebView.
    also in ios 6 i read about suppressesIncrementalRendering = True but i want to support ios5, also as UiWebViews are said to be running on main thread by default, i suspect when loading of webViews and when user tries to scroll the page, the main thread is busy, but i want the scroll of the page to be smooth  even though the loading of UiWebViews may take time.

    You will probably get a faster and more accurate answer if
    you repost in the Developers Forum.

  • How to make the search faster  in a table ?

    hi ,
    i have got a table wich has one field as a primary key , and this table got 500000 records in it
    wich i try to pop up the (LOV)  it takes about one minute to be retreived
    i dodnt know how to make it faster ?
    could anyone help me how to make faster ?
    and what index should i put on this table ?

    thanks for your help
    and here is the the
    CREATE TABLE MOBWORKSHOP.MOBWSH_GUARANTY
      GRNTY_NO          VARCHAR2(10 BYTE),
      I_CODE            VARCHAR2(30 BYTE),
      SERIAL_NO         VARCHAR2(30 BYTE)           NOT NULL,
      GRNTY_START_DATE  DATE,
      GRNTY_EXPIR_DATE  DATE,
      GRNTY_VALIDTY     NUMBER(1),
      CAUSE_ID          VARCHAR2(10 BYTE),
      NOTE              VARCHAR2(60 BYTE),
      AD_U_ID           NUMBER(5)                   NOT NULL,
      AD_DATE           DATE                        NOT NULL,
      UP_U_ID           NUMBER(5),
      UP_DATE           DATE,
      BRN_NO            NUMBER(6)                   NOT NULL,
      BRN_YEAR          NUMBER(4)
    TABLESPACE MOBWRKSHPTRANS
    PCTUSED    0
    PCTFREE    10
    INITRANS   1
    MAXTRANS   255
    STORAGE    (
                INITIAL          64K
                MINEXTENTS       1
                MAXEXTENTS       UNLIMITED
                PCTINCREASE      0
                BUFFER_POOL      DEFAULT
    LOGGING
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;
    CREATE UNIQUE INDEX MOBWORKSHOP.MOBWSH_GUARANTY_PK ON MOBWORKSHOP.MOBWSH_GUARANTY
    (GRNTY_NO)
    LOGGING
    TABLESPACE INDX_TRANS_MOBWRKSHP
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
                INITIAL          64K
                MINEXTENTS       1
                MAXEXTENTS       UNLIMITED
                PCTINCREASE      0
                BUFFER_POOL      DEFAULT
    NOPARALLEL;
    ALTER TABLE MOBWORKSHOP.MOBWSH_GUARANTY ADD (
      CONSTRAINT MOBWSH_GUARANTY_PK
    PRIMARY KEY
    (GRNTY_NO)
        USING INDEX
        TABLESPACE INDX_TRANS_MOBWRKSHP
        PCTFREE    10
        INITRANS   2
        MAXTRANS   255
        STORAGE    (
                    INITIAL          64K
                    MINEXTENTS       1
                    MAXEXTENTS       UNLIMITED
                    PCTINCREASE      0
    ALTER TABLE MOBWORKSHOP.MOBWSH_GUARANTY ADD (
      CONSTRAINT MOBWSH_QRNTY_I_CODE_FK
    FOREIGN KEY (I_CODE)
    REFERENCES MOBWORKSHOP.ITEM_DETAILS (I_CODE),
      CONSTRAINT MOBWSH_CANCEL_CAUS_FK
    FOREIGN KEY (CAUSE_ID)
    REFERENCES MOBWORKSHOP.GUARANTY_CANCEL_CAUSES (CAUSE_ID));
    i made  a button to show  (LOV) and when i press the putton it take about one minute to view the LOV

  • How to make download spped fast?

    Having problem with download speed. We rented a movie and itunes estimates over 1000 min. We had 100mb/sec connection. How we can make the download faster?

    Its an on going process. Couple of steps you will have to follow: Did you perform any SQL trace ..?
            Did you perform any ABAP trace...?
            How much business data these reports are processing.Is there a possibility you can do some changes.
    SQL Trace ( SAP in built tool) will give you a fair idea about each and every SQL statements in your report. And you can anlyze bad ones. And also propse optimized SQL or
    index if needed.
    ABAP Trace(SAP in bulit tool), you can find out amount of ABAP run time thats being elapsed by each and individual abap module.
    Also the amount of business data is every  important. While designing the report alogorithm this is very important factor.

  • How to make my program faster?

    I have a program which produces two elements array. In normally the program ends in microseconds, however when I organize my program to send the array as a data to DAQ.mx write and the array will be the voltage output from my NI USB-6012 DAQ, my program ens in 40 seconds. How can I make my program faster? Is there any solution?
    I have attached the normal program and with DAQ.vis.
    Attachments:
    step step 1.vi ‏15 KB
    step step 2.vi ‏34 KB

    Program 1 runs 5 times and program 2 runs 41 times per loop. the total number of inner iterations is 25 vs. 1681 for a 67x difference.
    Program 1 and program 2 have no timing information, thus spin at a undefined rate.
    Program 2 does single point hardware IO and also has no timing information. The speed will depend on the hardware.
    Running at a hardware dependent rate is not a good idea in general, because the speed will vary with every change in hardware and is not deterministic. You don't even know what occurs first at each iteration: the input or the output.
    If speed is important, what you should do is use an improved variation (Yes, use FOR loops and ramps!) of program 1 to generate the final data array, then do a single "Nchan,Nsamp" IO, running input and output synchronized hardware timed off the same clock. This way you can select any acquisition speed up the the maximum supported by your DAQ hardware. It will be fast and at an exactly defined rate as it should be!
    Try it!
    I am not familiar with your hardware: USB-6012. can you give a link to the product page?
    LabVIEW Champion . Do more with less code and in less time .

  • How to make materialized view fast refresh parallel

    We have Oracle 11.2.0.1 on Redhat 5.2. We use a dozen of fast refresh materialized views in our application.
    From time to time MV refresh takes longer time than the refresh interval.
    One of way to improve performance of MV refresh is to make the refresh parallel, e.g. http://www.dba-oracle.com/t_materialized_views_refreshing_performance.htm
    - Use parallel DML - Oracle author Michael Armstrong Smith notes "I've done parallel materialized view refreshing
    on tables recently and improved the load times considerably. Rather than having one load which took 2 hours,
    I run 4 parallel loads, one for each partition. The length of time for the whole process is now determined by
    how long the biggest partition takes to load. In my case, this is 40 minutes, with two 30 minute loads and one
    20 minute load.  Overall I am saving 1 hour 20 minutes. I can now add further partitions and do the same thing.
    My only limitation is the parallel loads because I don't have unlimited processing power.
    {code} My master tables are not partitioned, but think parallel will still better than non-parallel.
    Now the question, how to make refresh parallel. According to the paragraph cited above, Use parallel DML appears doing the job. Can someone  confirm that.
    We use {code}
    alter materialied view MV_OFFENSE parallel REFRESH FAST start with sysdate next sysdate+ 1/24;
    {code}to schedule refresh. Does the parallel clause here parallels query the MV or refresh the MV?
    Any other way to make MV refresh parallel?
    Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Doc http://download.oracle.com/docs/cd/E11882_01/server.112/e16579/refresh.htm#i1006319 says:
    >
    In a data warehousing environment, assuming that the materialized view has a parallel clause, the following sequence of steps is recommended:
    1.
    Bulk load into the fact table
    2.
    Enable parallel DML
    3.
    An ALTER SESSION ENABLE PARALLEL DML statement
    4.
    Refresh the materialized view

  • How to Make Parallax Scrolling Linger Longer in Position?

    Hi,
    I have downloaded the sample paralax file from this tutorial (http://tv.adobe.com/watch/muse-feature-tour/adobe-muse-parallax-scrolling-may-2013/), and I'd like to ask how to make the formed words, once in position, to linger for a certain time of scroll in their position, and only then move away.
    Thanks for your help, and please ask if further clerification is needed.

    Currently Muse doesn't support what you are requesting.
    At the moment Muse allows you to set one key position and define actions before that key position and after that key position.
    What you're requesting is :
    01. before key position - do action (move)
    02. for duration of scroll - do action (don't move)
    03. after key position - do action (move)
    If you would like to see this enhancement. Please request it in the Ideas section.

  • How to make page scroll automatically on click, plz help ASAP

    Hi!
    I need to know how to make a page scroll up or down automatically when i click on an image.
    Too see example click here: http://www.morphix.si/
    I am very new to Dreamweaver and coding, so please be gentle. But I need help A.S.A.P if it's possible! =)
    Thanks!

    Hit F1 (help) and search for Named Anchors.
    The example page is one, very tall page with several named anchors on it.  When you click a button it takes you to the designated anchor on the page.
    <a href="#top">Link to Top</a>
    <a href="#bottom">Link to Bottom</a>
    The gliding effect is done with jQuery.
    http://www.position-absolute.com/articles/better-html-anchor-a-jquery-script-to-slide-the- scrollbar/
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb
    http://alt-web.blogspot.com

  • How to make SMOOTH scrolling with Jtable in Swing automatically ?

    Hi All,
    I'm coding for a price board program, with all records I designed a table for them. So now I want to scroll automatically for all records on that table for customers viewing them. The problem that I can make it scroll smoothly ! Currently I use this block code :
    Thread scollTable;
    int scrollCount = 38;
    public void scrollTable(final int records) {
    if (scollTable == null) {
    scollTable = new Thread() {
    @Override
    public void run() {
    try {
    while (true) {
    if (scrollCount == 38) {
    jTable1.setRowSelectionInterval(scrollCount, scrollCount);
    scrollRowToVisible(scrollCount, jTable1);
    Thread.sleep(4000);
    jTable1.setRowSelectionInterval(scrollCount, scrollCount);
    scrollRowToVisible(scrollCount, jTable1);
    Thread.sleep(1000);
    scrollCount++;
    if (scrollCount == records) {
    scrollCount = 0;
    Thread.sleep(4000);
    jTable1.setRowSelectionInterval(scrollCount, scrollCount);
    scrollRowToVisible(scrollCount, jTable1);
    scrollCount = 38;
    continue;
    } catch(Exception ex) {
    if (!scollTable.isAlive()) {
    //scollTable.setPriority(7);
    scollTable.start();
    public void scrollRowToVisible(int row, JTable table) {
    Rectangle cellRect = table.getCellRect(row, 0, true);
    Rectangle visibleRect = table.getVisibleRect();
    cellRect.x = visibleRect.x;
    cellRect.width = visibleRect.width;
    table.scrollRectToVisible(cellRect);
    The problem I think the progam can not run smoothly with scroll :
    scrollRowToVisible(scrollCount, jTable1);
    Thread.sleep(1000);
    scrollCount++;
    Any helps,
    Thanks.
    Edited by: onlysang2004 on Aug 4, 2009 2:22 AM

    Could you please tell me more detail ? I studied about Swing recently ! I found a link for that javax.swing.Timer : http://forums.sun.com/thread.jspa?threadID=5366085&messageID=10603235#10603235 but how can I use ? In my price board screem doesn't have ActionListener object or button to listen to submit. Can I create an ActionListener object ? Please help me more, how to run smooth scrolling automatically !
    public class ViewElectricHaSTC extends JFrame {
    Thread scollTable;
    public ViewElectricHaSTC(Options options) throws Exception {
    scrollTable(options.getRecord());
    int scrollCount = 38;
    public void scrollTable(final int records) {
    if (scollTable == null) {
    scollTable = new Thread() {
    @Override
    public void run() {
    try {
    while (true) {
    if (scrollCount == 38) {
    //jTable1 created with initComponents method
    jTable1.setRowSelectionInterval(scrollCount, scrollCount);
    scrollRowToVisible(scrollCount, jTable1);
    Thread.sleep(4000);
    jTable1.setRowSelectionInterval(scrollCount, scrollCount);
    scrollRowToVisible(scrollCount, jTable1);
    Thread.sleep(1000);
    scrollCount++;
    if (scrollCount == records) {
    scrollCount = 0;
    Thread.sleep(4000);
    jTable1.setRowSelectionInterval(scrollCount, scrollCount);
    scrollRowToVisible(scrollCount, jTable1);
    scrollCount = 38;
    continue;
    } catch(Exception ex) {
    if (!scollTable.isAlive()) {
    //scollTable.setPriority(7);
    scollTable.start();
    public void scrollRowToVisible(int row, JTable table) {
    Rectangle cellRect = table.getCellRect(row, 0, true);
    Rectangle visibleRect = table.getVisibleRect();
    cellRect.x = visibleRect.x;
    cellRect.width = visibleRect.width;
    table.scrollRectToVisible(cellRect);
    Edited by: onlysang2004 on Aug 4, 2009 7:23 PM

  • Does Anybody Know how to make Safari 3 Faster?

    Does Anybody Know how to make Safari 3 a little bit faster for WIndows?

    Come on does anybody know plzz?

Maybe you are looking for

  • Master slide images not loading properly when previewing or when published

    I have created a master slide (including image) to be the background for my piece.  The image looks fine when I am in Captivate but when I preview the project the image does not display fully and only shows up bright bright white.  I tried publishing

  • How do I play iTunes TV shows full screen on a connected display?

    I have connected my HDTV via DVI to HDMI cable and I want to play the TV shows I've dowloaded FULL SCREEN ON THE TV. When I selected full screen, it defaults to playing the show full screen on my macbook and not my TV. I just want to change it so tha

  • Database is in 'STARTED' state error???

    Hi, Has anyone ran a Job in OEM and encountered this error: Database is in 'STARTED' state If so, how can I correct this problem. I looked on Metalink and it said to connect tot he DB with the dbsnmp account, but that did nothing. Any ideas?

  • OEM 9.2.0.1.0 Archive Log Mode

    I've done this numerous times, but cannot remember how to bring a database up in Archive Log Mode so I can use Dataguard Manager. Can anyone refresh my memory?

  • I would appreciate some help.

    Hello, I had a problem recently where my imac crashed to a blue screen while running windows in bootcamp. It appeared to be a major problem and I could no longer boot to the windows partition. I was able to finally start my computer up on the mac par