JScrollPane's scrollbar on left handside

Is there a way to set JScrollPane's vertical scrollbar on left hand side.

Well I believe it is more work like this... I preferd to disabled the manager for the vertical JScrollBar and keep the rest of its functionnality... and add a small manager on the extra vertical JScollBar... but we can not know until someone tryies it!!!;0)))
JRG

Similar Messages

  • JScrollPane with scrollbar as needed packs to the wrong size.

    Hi!
    I just noticed a strange problem when packing a JScrollPane with scrollbar policy "as needed" and wondered if it's me or if it is a real bug in Swing.
    I create a JFrame with a JScrollPane in it and a JPanel as viewportview. The JPanel (called "stuffPanel") contains a few components which give it a preferred size, and the JScrollPane is set to grow as needed if the window grows. A button in the center of the stuffPanel will invoke pack() on the window when clicked.
    Now, if I resize the window such that the JScrollPane can't display the entire stuffPanel, I get scrollbars as expected. If I click the pack button the window correctly resizes to the preferred size (without scrollbars).
    On the other hand, if I resize the window to become larger than the preferred size and then click the pack button, the window (and the stuffPanel) is resized to include 17 pixels of extra size around the edges.
    Put simply, pack() will resize the JPanel to different sizes depending on whether the scrollbars of the JScrollPane were visible at the time. Note that this only occurs when you're using the "scrollbars as needed" scrollbar policy.
    An even more interesting situation occurs if you resize the window to include (for example) only horizontal scrollbars and then packs the window repeatedly...
    Code for a Java app which displays the strange behaviour is included below:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class TestJScrollPane {
      static {
        try {
          UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        catch (Exception e) { }
      private JFrame mainWindow;
      public TestJScrollPane() {
        mainWindow = createMainWindow();
        mainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        mainWindow.pack();
        mainWindow.show();
      public JFrame createMainWindow() {
        JFrame window = new JFrame("Test of scrollpane");
        window.getContentPane().setLayout(new GridBagLayout());
        final JPanel stuffPanel = new JPanel();
        stuffPanel.setBorder(BorderFactory.createTitledBorder("Collection of stuff"));
        stuffPanel.setLayout(new GridBagLayout());
        JLabel stuffLabel = new JLabel("A label");
        JTextField stuffField = new JTextField(10);
        JButton stuffButton = new JButton("Pack the window");
        JList listOfStuff = new JList();
        listOfStuff.setListData(new String[] {"Fish", "Bird", "Mammal", "Insect", "Spider"});
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        stuffPanel.add(stuffLabel, gbc);
        gbc.gridx = 1;
        stuffPanel.add(stuffField, gbc);
        gbc.gridy = 1;
        gbc.gridx = 0;
        gbc.gridwidth = 2;
        stuffPanel.add(stuffButton, gbc);
        gbc.gridy = 2;
        gbc.fill = GridBagConstraints.BOTH;
        stuffPanel.add(listOfStuff, gbc);
        final JScrollPane scroller = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        scroller.setViewportView(stuffPanel);
        gbc = new GridBagConstraints();
        gbc.fill = GridBagConstraints.BOTH;
        gbc.weightx = 1;
        gbc.weighty = 1;
        window.getContentPane().add(scroller, gbc);
        stuffButton.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mainWindow.pack();
            System.out.println("Stuff panel size: " + stuffPanel.getSize());
            System.out.println("Stuff panel preferred size:" + stuffPanel.getPreferredSize());
            System.out.println("Scroller size: " + scroller.getSize());
            System.out.println("Scroller preferred size: " + scroller.getPreferredSize());
        return window;
      public static void main(String[] args) {
        new TestJScrollPane();
    }

    Why would the JScrollPane be as big as the entire
    frame when you added 800x600 panels on all sides of
    it? It's going to be in the center surrounded by
    huge panels. Thanks, kablair. However, if you look at the code, these panels are not 800x600 on all sides. The north and south panels only add a combined height of 100, and the east and west panels only add a combined width of 100. so the whole window, minus insets, should be 900x700.
    Anyway, i took the advice of the guy above, and that has gotten me much closer. In the bigger app that I'm trying to calculate the size, now I'm only 2 pixels away from the true size, although I can't figure out what I'm forgetting.

  • Have lotus notes on my Ipad , but since a few days I can only see the headers of the mails on the left handside but on the right one where I should actually see the content of the mail , I can only see the header

    Have lotus notes (mail) on my Ipad but since a few days I see on the left handside the header of the mails , if I choose one , in only get the header
    on the right side but the mail does not open and also I cannot see any attachements? Did compare the settings with my collegues and they are
    excactly the same. Would somebody know what could be wrong??

    Try closing the Mail app completely and see if the email contents show when you re-open the app : from the home screen (i.e. not with the Mail app 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Mail app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
    If that doesn't work then also try a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.

  • JScrollPane's scrollbar's position

    Hi All,
    I have a problem in JscrollPane .
    In my swing application , I have used JScrollPane , now on thic pane
    the horizontal scrollbar is bydefault is on the left side of this pane ,
    I want to replace it on the middle of the pane ,
    can anybody help me
    Thanks ,
    Satya

    Your horizontal scroll bar is on the left?? Not on the bottom?
    And you want it in the middle of the scroll pane??
    I can only assume something quite important has been lost in translation here :o)

  • DataGrid scrollbar on left side.

    I know I have seen a topic about this somewhere but this
    forum has such a bad searchfunction that I cant find the answer...
    I have 2 DataGrids, 1 must have the vertical scrollbar on the
    right side (normal), and 1 must have the vertical scrollbar on the
    left side (not normal).
    I have tried everything I could think of. Help files didn't
    help, tutorials didn't help, looking through the UIScrollbar and
    DataGrid class files didn't help either.
    I'm stuck...
    If anyone knows how to do this, please share.
    p.s. the tricks that people use to get the scrollbar to the
    left in a "scrollpane" component do NOT work for
    DataGrids...

    Also tried:
    _root.myDG.vScroller._x = 0;
    _root.myDG.setHPosition(-15);
    didn't work... I also tried adding this:
    myDG.vScrollPolicy = "off"; (this removes the vertical
    scrollbar)
    and then adding an additional UIScrollbar component into the
    DataGrid... but even after configuring it correctly it will not
    interact with the DataGrid (perhaps it only works for textfields).
    Anyone?!?

  • How move vertical scrollbar to left side (for lefties on tablets)

    till now in all previous ff i could easily move vertical scrollbar from right side to left. but i cant find the instruction now

    Set the pref layout.scrollbar.side to '3' to place the scroll bar at the left side.
    See http://kb.mozillazine.org/layout.scrollbar.side (default is 0: user interface)
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />

  • Move scrollbar to left side of component

    I would like to create a container with a scrollbar on the
    left-hand side. How can I do this in MXML or Actionscript?
    Thanks!
    Russ

    LOL - oh boy do I....
    Check the uberlink and MacFly tutorials at PVII
    http://www.projectseven.com/)
    and the Navbar tutorial/articles at Thierry's place
    http://tjkdesign.com/articles/dropdown/)
    Or this one (more recent article):
    http://tjkdesign.com/articles/Pure_CSS_Dropdown_Menus.asp)
    Or to get it done fast, go here -
    http://www.projectseven.com/tutorials/navigation/auto_hide/index.htm
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Codeless" <[email protected]> wrote in
    message
    news:eita8l$a8f$[email protected]..
    > Thanks for the bluntness.
    > Do you have a suggestion or alternative to these boulder
    sucking menus?
    >
    > Thanks

  • Jscrollpane without scrollbar

    adf bc swing appilcation, jdeveloper 10.1.3
    this is my form structure
    this (gridbag layout)
    jscrollpane(default layout)
    jpane (null layout)
    jpane2
    jtabbedpane
    jscrollpane size < jpane size
    why the scroll bar of the jscrollpane doesn't appear ??

    Hi,
    it only appears if there are components that are placed outside of the viewport. Add a table and if this is big enough it will cause the scrollbar to show.
    You can however set the vertical scrollbar property to always show the scroll bar. By default it only shows it when needed
    Frank

  • Scrollbar on left side of Datagrid

    I was able to move the scrollbar to the left side in a datagrid using the following:
            protected override function updateDisplayList( unscaledWidth:Number, unscaledHeight:Number ):void
                super.updateDisplayList( unscaledWidth, unscaledHeight );
                if( verticalScrollBar && verticalScrollBar.visible ){
                    verticalScrollBar.x = 0;
    This only moved the scrollbar and not the header for the scrollbar. It also does not move the columns over.
    Is there a way to do this? There doesn't seem to be any examples for moving a scrollbar to the left side of
    a datagrid except for the code that i've listed above.

    I have tried this
    verticalScrollBar is created only when displayed, so the rigth way is update it's position in updateDisplayList, but listContents displayed with errors.

  • ScrollPane: Howto have vert. scrollbar on left side ?

    Is there a way to have the vertical scrollbar (on a scrollpane) on the left side (rather than on the right side) ?

    AFAIK only by using your own skin for ScrollPane (and probably TreeView, ListView and TableView).

  • Tip: Moving Vertical Scrollbar To Left-Side

    I like being able to move the vertical scrollbar to the left-side of the viewing area.
    But the problem is with CSSs position:absolute and position:fixed is that if the left attribute is set to less than 20 the scrollbar will cover it up. For instance left:5px will be covered by the scrollbar.

    Set the pref layout.scrollbar.side to '3' to place the scroll bar at the left side.
    See http://kb.mozillazine.org/layout.scrollbar.side (default is 0: user interface)
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />

  • Web template SCROLLBARS into Left

    Hi Experts,
    We have a requirement into which we need scrollbar into web template into left hand side instead of usual right hand side.
    Using USE_SCROLLBARS value="ENABLED" option helps to enable scrollbar but it appears into right hand side.
    Do anybody have some way/code to bring it towards left hand side. Please suggest.
    Thnaks
    Sangita

    Hi Sangitha...
    How to Transport Web Template
    Transport Sequence
    Info Objects,
    DSO
    INFO CUBE
    TRANSFORMATIONS
    MP
    INFOSETS
    PROCESS CHAINS
    QUERIES
    Objects need to be transported with respect to their
    dependencies
    Infoproviders will bring in all relevant Infoobjects
    Importing of Global variables is dependant on their reference
    Infoobjects being already active
    Queries, workbooks and roles are dependant on Infoproviders
    and InfoObjects being active
    Use the Transport Connection Tool to analyze your objects
    Transport all customer-defined packages (dev classes) before
    transporting objects
    Transport InfoProvider(s) using the "In Data Flow Before" or
    "Only Necessary Objects" grouping option
    Transport all Global Variables with primary package assignment
    i.e. ZBW
    Transport BEx objects with appropriate individual package
    assignment
    Transport roles and workbooks together
    Please go through the below links ...I think this will helps you sangitha....!
    /people/balint.almasi/blog/2006/12/11/how-to-create-a-transport-request-save-for-system-copy
    take a look thread
    Transports -Procedure
    transport tips
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3010ba90-0201-0010-2896-e58547c6757e
    Regards
    Sudheer

  • JScrollPane in a JFrame scrollbars visible but not functional no thumbtabs

    Here is the code that I compiled and run on J2SE v. 1.4.2 (runtime b28). I looked through the various related articles and nothing seems to help with this issue. The scrollbars appear along with the panel but the thumbtabs are not present. Any help would be appreciated.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Test {
      public static void main(String[] args){
        Test rce = new Test();
        JFrame frame = new JFrame("Test Scroll");
        JScrollPane scrollBar = new JScrollPane();
        scrollBar.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
        scrollBar.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        Component  rcePage = rce.createComponents();
        scrollBar.getViewport().add(rcePage, null);
        frame.getContentPane().add(scrollBar, null);
        frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        frame.pack();
        frame.setSize(400, 400);
        frame.setVisible(true);
      public Component createComponents() {
        JPanel pan = new JPanel();
        JLabel label = new JLabel("This is a Test!");
        pan.setBorder(BorderFactory.createEmptyBorder(
            0, //top
            0, //left
            0, //bottom
            0) //right
        pan.setLayout(null);
        label.setBounds(100, 100, 80, 20);
        pan.add(label);
        return pan;
    }

    This is a very common mistake. When you put a JPanel in a scrollpane, the scrollpane will use the panel's preferred size to determine if scrolling is needed or not. If the panel is using a LayoutManager this is generally done for you automatically. But in your case you set the layout to null, and then it is your responsibility to make sure that the getPreferredSize() method of the panel returns the correct size.
    One way to fix this in the code you posted would be to override the getPreferredSize() of the panel, like so:
        public Component createComponents() {
            JPanel pan = new JPanel() {
                public Dimension getPreferredSize() {
                    return getSize();
        }Then the scrollbars will appear if you make the frame smaller.
    But what I really suggest is that you use a LayoutManager.

  • Placing ScrollBar Back On Top Of The JScrollPane

    Hi....
    Just a tiny problem......I have a problem placing the scrollbar back on top of the JScrollPane after few sentences of words are placed into the JTextArea at once. The JTextArea is within the JScrollPane.
    Does anyone has any idea on how I can position the scrollbar back on top of the JScrollPane after the words are placed into the JTextArea.....???
    Britney

    Just some additional comments for anyone who is searching for this solution in the future (as I was today)...
    Neither of these two lines of code did anything by itself. The scrollbar was left at the bottom of the text area.
    myScrollPane.getVerticalScrollBar().setValue(0);
    myScrollPane.scrollRectToVisible(new Rectangle(0,0,1,1));This line by itself basically worked - the scroll pane was reset to the top so that you could see the top line of text. However, if I had previously scrolled down, the scroll bar was not reset all the way to the top (it was just a tad below the top).
    myTextArea.setCaretPosition(0);To get the scroll pane AND scroll bar to reset to the top, I used BOTH of the following lines of code. This is definitely the best solution I have found:
    myTextArea.setCaretPosition(0);
    myScrollPane.getVerticalScrollBar().setValue(0);Something else I had tried in the past was this:
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            myScrollPane.getViewport().setViewPosition(new Point(0, 0));
    });This worked in that it reset the scroll pane to the top, but you could see it scroll down to the bottom as text was added, and THEN it reset to the top, causing a "flashing" effect.
    Hope this helps anyone struggling with this issue in the future.
    Barb

  • Java Bug? Centering a JLable with just an icon in a JScrollPane

    Hi,
    I'm attempting to write a image viewing program. I would like the image centered on the window displaying them, but because some images are larger than the window, I would like the image to be in the upper left hand coner of the window with scroll bars to allow you to view the rest of the image.
    I have attempted to implement this by placing a JScrollPane on a JFrame, and then placing a JLabel in the JScrollPane's Viewport. I set the Label's text to blank, and then set the image, wraped in an InageIcon, as the JLabel's Icon.
    To center the JLabel, I have tried to set the JScrollPane's Viewport's LayoutManager to two different layout managers, but I've found buggy operation with each. The Layout I've tried are the following:
    1. a GridLayout(1,1,0,0); - this works fine when the image is smaller that the available area of the JScrollPane. However, if the window is resized so that the image more than totally fills the JScrollPane, the image gets cut off. What happens is that the image is centered in the available scrollpane view, meaning the uper and left edges of the image get cut off. Scroll bars appear to let you view the lower and righer edges of the image, however, when you scroll, the newly uncovered areas of the image never get drawn, so you can't get to see the lower or right edges of the image either.
    2. a GridbagLayout with one row, and one column each with a weight of 100, centered and told to fill both horizontally and vertically. Again, this correctly centers the JLabel when th eimage is smaler than the available space in the JScrollPane. Once the window is resized so that the image is bigger than the space to view the image in, strange problems occur. This time it seems that the JScrollPane's scrollbars show that there should be enough room to show the image if the image was in the upper left corner, however, the image isn't in the upper left corner, it is offset down and to the right if the upper left corner by an amount that appears equal to the amount of extra space needed to display the image. For example, if the image is 200x300 and the view area is 150x200, ite image is offest by 50 horizontally and 100 vertically. This results in the bottom and right edges of the image getting cut off because the scrollbars only scroll far enough to show the image if the image was placed at 0,0 and not at the offset location that it is placed at.
    You may not understand what I'm trying to say from my description, but below is code that can reproduce the problem.
    Questions. Am I doing anything wrong that is causing this problem? Is that another, better way to center the JLabel that doesn't have these problems? Is this a JAVA Bug in either the layoutmanagers, JScrollPane or JLabel when it only contains an icon and no text?
    Code:
    this is the class that creates and lays out the JFrame. It currently generates a 256x256 pixel image. By changing the imagesize variable to 512, you can get a larger image to work with which will make the bug more obvious.
    When first run the application will show what happens when using the GridLayout and described in 1. There are two commented out lines just below the GridLayout code that use a GridbagLayout as descriped in method 2. Comment out the GridLayout code when you uncomment the GridBageLayout code.
    package centertest;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.awt.image.*;
    public class Frame1 extends JFrame {
        JPanel contentPane;
        BorderLayout borderLayout1 = new BorderLayout();
        JScrollPane jScrollPane1 = new JScrollPane();
        JLabel jLabel1 = new JLabel();
        static final int imagesize=256;
        //Construct the frame
        public Frame1() {
            enableEvents(AWTEvent.WINDOW_EVENT_MASK);
            try {
                jbInit();
            catch(Exception e) {
                e.printStackTrace();
        //Component initialization
        private void jbInit() throws Exception  {
            contentPane = (JPanel) this.getContentPane();
            contentPane.setLayout(borderLayout1);
            this.setSize(new Dimension(400, 300));
            this.setTitle("Frame Title");
            //setup label
            jLabel1.setIconTextGap(0);
            jLabel1.setHorizontalAlignment(JLabel.CENTER);
            jLabel1.setVerticalAlignment(JLabel.CENTER);
            jLabel1.setVerticalTextPosition(JLabel.BOTTOM);
            //create image and add it to the label as an icon
            int[] pixels = new int[imagesize*imagesize];
            for(int i=0;i<pixels.length;i++){
                pixels=i|(0xff<<24);
    MemoryImageSource mis = new MemoryImageSource(imagesize, imagesize,
    pixels, 0, imagesize);
    Image img = createImage(mis);
    jLabel1.setIcon(new ImageIcon(img));
    jLabel1.setText("");
    contentPane.add(jScrollPane1, BorderLayout.CENTER);
    //center image using a GridLayout
    jScrollPane1.getViewport().setLayout(new GridLayout(1,1,0,0));
    jScrollPane1.getViewport().add(jLabel1);
    //Center the image using a GridBagLayout
    /*jScrollPane1.getViewport().setLayout(new GridBagLayout());
    jScrollPane1.getViewport().add(jLabel1,
    new GridBagConstraints(0, 0, 1, 1, 100.0, 100.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(0, 0, 0, 0), 0, 0));
    //Overridden so we can exit when window is closed
    protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
    System.exit(0);
    and here is an application with which to launch the frame
    package centertest;
    import javax.swing.UIManager;
    import java.awt.*;
    public class Application1 {
        boolean packFrame = false;
        //Construct the application
        public Application1() {
            Frame1 frame = new Frame1();
            //Validate frames that have preset sizes
            //Pack frames that have useful preferred size info, e.g. from their layout
            if (packFrame) {
                frame.pack();
            else {
                frame.validate();
            //Center the window
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            Dimension frameSize = frame.getSize();
            if (frameSize.height > screenSize.height) {
                frameSize.height = screenSize.height;
            if (frameSize.width > screenSize.width) {
                frameSize.width = screenSize.width;
            frame.setLocation( (screenSize.width - frameSize.width) / 2,
                              (screenSize.height - frameSize.height) / 2);
            frame.setVisible(true);
        //Main method
        public static void main(String[] args) {
            try {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            catch (Exception e) {
                e.printStackTrace();
            new Application1();
    }I'm running Java 1.4.1 build 21 on Windows 98. I used JBuilder8 Personal to write this code.

    Hmmm,
    You are correct. Not setting a layout for the scrollpane's viewport (using the default of javax.swing.ViewportLayout) results in the positioning of the image tat I want (center the image if image is smaller than the scrollpane, if the image is larger, place it in the upper-left corener and enable the scrollbars to scroll to see the rest of the image).
    Anyone have any idea why the GridLayout and GridBagLayout act as they do? I gues it isn't that important tomy program, but I'm still not sure that they are operating correctly. (Specifically, GridLayout sha scrollbars, but when you scroll, no new parts of the image are revealed.)

Maybe you are looking for

  • At my wits end with broadband support

    Last week my connection dropped out - BTHomehub2, broadband light goes orange and appears to like it, as it stays that way for an hour and after a restart & reset.  Despite it being 10.30pm i'm pretty reliant on my connection, so i call up the suppor

  • Com.bea.xml.XmlException: failed to load java type corresponding to e=ejb-j

    When I try to migrate my ejb application from weblogic 8.1 to 9.2 using Ant build script , I have received the following error stacks : [wlappc] com.bea.xml.XmlException: failed to load java type corresponding to e=ejb-jar [wlappc]      at com.bea.st

  • Email not working with Apple ID

    Have iPod touch 5th Gen. In setting up Apple ID to iMessages, it states my email is already linked to Apple ID. However, the Apple ID wouldn't accept my acct. So I tried putting in my password with the Apple ID, changing password and finding Apple ID

  • Apxldimg is required from 3.1 to 3.2

    Hi all, If I upgrade APEX from 3.1 to 3.2 , do I need to run apxldimg.sql or not? My APEX environment is running via the Oracle HTTP server and modplsql , NOT embedded PL/SQL gateway. Tom

  • Error during factory reset

    Hello .  while iam trying to reset my laptop to factory condition i always get restoration incomplete message  details "  there is might be unexpected rebooting during BBV clean or last  the process will cause CTO panic becouse the image might be not