Why the vertical scrollbar bar is automatically scrolled to the bottom pos.

I created a JScrollpane to contain a JTabbedPane. The JTabbedPane has two JPanel and each of them has a number of GUI components such as JCheckbox and JTextField. They have different size because their GUI components are different. The 2nd panel is about twice the size of the first panel.
When the JScrollpane is shown, its vertical scroll bar is automatically scrolled to the bottom position. However, it is the first panel that is initially visible to the user. So, the user will see no GUI components of the first panel because the auto scrolling of the vertical scroll bar.
Can anyone tell me how to disable the auto scrolling?
I just want to let the scrollbar knob stay at the top so that the GUI components of the first panel (the smaller one) can be seen initially!

Works fine for me:
import javax.swing.*;
import java.awt.*;
public class TabbedPaneScroll extends JFrame
     private JTabbedPane tabbedPane;
     public TabbedPaneScroll()
          tabbedPane = new JTabbedPane();
          tabbedPane.setPreferredSize( new Dimension(300, 200) );
          getContentPane().add(tabbedPane);
          addNewTab( 10 );
          addNewTab( 5 );
          addNewTab( 20 );
     private void addNewTab(int fields)
          JPanel panel = new JPanel();
          panel.setLayout( new GridLayout(0, 1) );
          for (int i = 0; i < fields; i++)
               panel.add( new JTextField("" + i) );
          JScrollPane scrollPane = new JScrollPane( panel );
          tabbedPane.add(scrollPane, "" + fields);
     public static void main(String args[])
          TabbedPaneScroll frame = new TabbedPaneScroll();
          frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
          frame.pack();
          frame.setLocationRelativeTo( null );
          frame.setVisible(true);
}If you need further help then you need to create a [url http://www.physci.org/codes/sscce.jsp]Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.

Similar Messages

  • The find function used to automatically scroll to the next word, now it doesn't. How do I fix it?

    The find function used to automatically scroll to the instance of the word I was looking for. Now it doesn't. How do I fix this?
    == This happened ==
    Every time Firefox opened
    == a few months ago

    Hmm... you're right. I don't have access to that Google Doc, but our support.mozilla.com weekly metrics are on Google Docs, and I see the same issue there.
    https://spreadsheets.google.com/ccc?key=0Aibg4PvTbjUKcGlBLWEtZFhDTDJwN3ZCNXBUdTBIS0E&hl=en#gid=0
    It may be specific to Google spreadsheets (and whether or not you have permission to edit the doc). I'm currently trying to find out if that's a Firefox bug, or a Google bug. If you use the '''Ctrl-F''' keyboard shortcut, Google's Find feature takes over, so they obviously want people using their Find utility.

  • Scroll down programmatically the vertical scrollbar in hierarchical trees

    I manually select nodes in the tree. When the node is expanded the leaf nodes doesn4t appear on the screen. Then
    I have to scroll down the vertical scrollbar to see it.
    Is it possible to scroll the tree so that the selected node
    appears on the screen ??
    My forms version is 6.0.8.19.2
    Best regards

    You can make use of the property "Index Vals" and write a new value to the Table as shown below
    Regards
    Guru (CLA)
    Attachments:
    1.png ‏23 KB
    1.png ‏23 KB

  • Mouse or trackpad automatically scrolls down the screen

    Hello everyone. My mouse, without moving in the screen, automatically scrolls down the window I've got selected, don't know why. During this problem if I try to scroll upwards, it'll scroll down again, therefore I can't read websites, etc.
    It happens for a few secs, and then becomes normal again automatically.
    Any ideas or even better, solutions? Everything's updated, but it's really weird.
    Thanks in advance, and sorry for my poor English, not my first language.

    Don't worry about your english it's fine. English is my only language and I still have problems with it.
    I'm going to take a wild stab at this as it happened to me some time ago. Do you have a pen tablet with the pen laying on the tablet?

  • I don't want the language bar switches automatically depending on the site until I change it manually.

    I am using firefox 4.0 in mac. Whenever I go to the korean site, the language bar switches automatically to korean from english, but if I am back to english based site, the language still keep korean. I don't want the language bar switches automatically depending on the site until I change it manually. It's very annoying. Thank you.

    I don't know why it says that I use firefox 4... When I check in my About window it says 18.
    I do ignore the message about the plugins. But I've started to get a little bit annoyed that I have to move up and press the little x every time I navigate to a site that needs something like flash. It eats up the size of about two text rows... it feels so unnecessary that it's there. If I want flash I will install it... The browser doesn't have to inform me about it every time.
    I really hoped for a better answer. Hopefully the firefox crew will add an option to not show that kind of messages in the future.

  • Macbook pro keeps saying connection timeout, and it used to connect to the internet fine. what's up, why can't it find and automatically connect to the internet anymore???

    Macbook Pro keeps saying connection timeout and it used to connect to the internet fine. What's up, why can't it find and automatically connect to the internet anymore???

    Like this: https://discussions.apple.com/thread/2775868?tstart=0  ?

  • How do I get the Adobe PDF navigation bar to automatically appear at the top of my screen again instead of when I move my mouse?

    Before I upgraded my computer to Windows 7 and updated Firefox to the latest version, when I opened a PDF document online, the PDF navigation/menu bar would automatically appear at the top of the screen. Now it only appears at the bottom in a blue bar when I move my mouse around.

    cor-el, thanks for the tip. While I certainly scoured Adobe's preference settings to look for something relating to that exact thing, I never went to their help site until I got your post. I found out that the floating toolbar appears because the PDF opens in'' Read Mode'', which you can turn off for all future documents by doing this:
    * Quit your internet browser
    * Launch Acrobat (or Reader)
    * Choose Edit>Preferences
    * Click on the Internet category on the left
    * Deselect “Display in Read Mode by default”
    * Click the OK button.
    * Relaunch Acrobat
    Something important to note, if you have both Adobe Acrobat and Adobe Reader, you need to do the above in both programs (same steps).

  • Cuatom Forms: Loosing the Vertical scrollbar when resizing the Window

    Hi All
    I have developed a Custom Form. In that there is a Content Canvas and on the top of that I have put a Stacked Canvas so that i can get both the Horizontal and Vertical scrollbars. the form has more than 40 fields to display.
    Folder tool functionality has also been added to the Form.
    The form works absolutely fine and scrollbars too.
    But when I am resizing the window (making the window size bigger or smaller by dragging the window on the Oracle Apps screen), at that time I am loosing the vertical Scrollbar. Other than Vertical scrollbar everything works fine.
    Is there any way (any code) by which the Vertical Scrollbar will not disappear.
    I would really appreciate if any one could guide me on this.
    Thanks
    Madhu

    Madhu,
    Please post your message in the Oracle E-Biz forum. This forum is for Non-EBS Forms development and everyone here may not have EBS Forms development experience.
    That having been said, I encountered this about a year ago. If I remember correctly, we were able to resolve the issue by applying a Forms server patch to the Apps Tech stack. Please check Metalink to verify.
    Craig...

  • Styling the Vertical Scrollbar of a Tilelist

    Is there any way within flex to style the vertical scrollbar of a tilelist rather than using the boring default scrollbars? What I have in mind is to have an up and a down arrow at the top and bottom of where the regular scrollbar would actually be then when my tilelist has more items than it's heaight these arrows will enable and act like a scrollbar.
    Is this possible?

    This example uses Degrafa (right-click to View Source):
    http://pv3d.org/2009/04/14/theres-more-than-one-way-to-skin-a-scrollbar/
    http://www.foxarc.com/blog/article/101.htm
    If this post answers your question or helps, please mark it as such.

  • How can I move the vertical slider bar from the right to the left of screen

    how can I move the vertical slider bar from the right to the left of screen

    There are also other things that need attention:
    Your above posted system details show outdated plugin(s) with known security and stability risks that you should update.
    # Shockwave Flash 10.1 r85
    # Next Generation Java Plug-in 1.6.0_18 for Mozilla browsers
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
    *http://www.adobe.com/software/flash/about/
    Update the [[Java]] plugin to the latest version.
    *http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE)

  • HT1533 Ok so I have tried evey combination of restarts. It tries to boot up, the start up bar appears on screen, but the computer just goes completely after the bar is a third of the way across. Is is doomed?

    Ok so I have tried evey combination of restarts. It tries to boot up, the start up bar appears on screen, but the computer just goes completely after the bar is a third of the way across. Is is doomed?

    Have you tried booting into the Recovery HD and running Disk Utility to see if anything needs fixing on the HD. Restart holding down Command+r and once it hopefully boots select Disk Utility>Repair Disk. If anything gets fixed click on repair disk again until you get a clean pass. Try restarting as normal from the Apple menu once done.
    Do you have backup to restore from if it proves to be the Mac has a hardware fault?

  • After upgrading to Lion, Preview (5.2.2) appears to have lost the facility to run a slide show by using my mouse to click an icon in the visible menu bar, as I could in the previous version.  Can I retrieve that icon and thus that facility?

    After upgrading to Lion, Preview (5.2.2) appears to have lost the facility to run a slide show by using my mouse to click an icon in the visible menu bar, as I could in the previous version.  Can I retrieve that icon and thus that facility?

    Unfortunately not. Lion has made many adjustments to the previous system. Try opening your pdfs in keynote.

  • The "small ball" on the mouse allows me only to scroll to the top not to the bottom

    The "small ball" on the mouse allows me only to scroll to the top not to the bottom

    Crud builds up under the ball and prevents the rollers from operating properly.
    Turn it upside down and rub the ball vigorously with a microfiber cloth.
    Regards,
    Captfred

  • Why does iGoogle automatically scroll to the bottom of the page?

    When I open iGoogle (which is my homepage) in Safari on my MacBook, the page automatically goes all of the way to the bottom. This leaves the search box back at the top and I have to manually scroll back up to enter whatever it is I'm searching for in the box. I want the page to open and with the iGoogle icon and search box right up front. Anyone know why this is happening and how I can fix it?

    seems this is happening on the embarq homepage and others as well. The page just jumps to the bottom for no apparent reason. This just started happening on my computer. Running 10.5.1. Any thoughts or ideas?

  • Introducing the Vertical Scrollbar to a selection screen.

    hi all,
    I wrote a program and use the WRITE command to display its values. code below...
    WRITE:/(181) sy-uline.
      WRITE:/ 'MVT',
      sy-vline, 'ADDITIVES',
      25 sy-vline,'CIRCLES',
      44 sy-vline,'COILS',
      64 sy-vline,'INGOT',
      83 sy-vline,'PRO. SCRAP',
      103 sy-vline,'PUR. SCRAP',
      123 sy-vline,'SHEETS',
      142 sy-vline,'SLAB',
      163 sy-vline, 'impscrap',
      181 sy-vline.
      WRITE:/(181) sy-uline.
    The problem i have now is that the whole data seem distorted because there is no vertical scrollbar.....Is it possible to add a scroll manually or it has to be done only automatically.. and if automatically under what condition does this happen?? Thanks..

    Your question is somewhat confusing.
    You ask about the selection screen, but the question seems more related to the report.
    You say vertical scrollbar, but the report seems to need a horizontal scrollbar.
    In ane event, try adding:
    LINE-SIZE 255
    to the REPORT statement.
    Rob

Maybe you are looking for

  • It is possible to embed a pdf file in a report?

    Hi community, The question is a little bit complex, cause we do not know if belongs to Reports or tu E-Business-Suite. Our development Team has just created a report for a list of purchased/sold goods, which output is a PDF file. On the other hand, t

  • Multiple select list in Safari 8.1 is broken again

    Multiple select list is broken again in iOS 8.0.* and 8.1 Safari. Few temp solutions can be found here until apple fixes this issue again. Multiple Select box does not retain selected choice Multiple Select on Safari - iPhone iOS 7

  • Importing .shp files

    I'm using map builder to import .shp files. I want to know, if i've each layer as a separate .shp file, should i import each file in a separate table?, then how can i preview the whole map with its labels. Another question, when i duplicate a style o

  • Main method question in java, please help

    Guys I have looked all over the internet, and cannot understand any of these questions: I would really appreciate any help on them. The first, and most important thing I would like to know is, what is static: what is a static int, or a static main me

  • Init() method is executing twice

    Hi, I have a servlet & implemented the init() method. But, the init() method is executing twice. Also, the destroy() method is executing twice. Any input guys. Thanks