Creating JScrollPane with vertical scroll only...

Anyone got any idea how to use a JScrollPane to perform vertical scrolling only?
The components should be stacked vertically, as wide as the scrollpane and as high as they need to be.
Is it only possible by adding a ComponentListener to the JScrollPane (or the JViewPort) and setting the maximum width of the components to the width of the viewport?
Incidentally, anyone know how a JLabel (or any text component) calculates its preferred size when it can wrap the text contained? Ie, how do you get the preferred height for a specified width?

Doh - implement Scrollable to return true for getScrollableTracksViewportWidth()!

Similar Messages

  • Create user with select privilege only one schema

    can someone tell me how i can create user with select priviliges only one schema.
    i don't want the user to have any select privileges with other schema.
    can someone advise me.
    Thansk

    In general, you would do something like
    CREATE ROLE abc_read_only;
    FOR x IN (SELECT * FROM dba_tables WHERE owner='ABC')
    LOOP
      EXECUTE IMMEDIATE 'GRANT SELECT ON abc.' || x.table_name || ' TO abc_read_only';
    END LOOP;
    CREATE USER your_user ...;
    GRANT abc_read_only TO your_userYou create a role, grant the role SELECT access to all the tables in the ABC schema (you can extend this to grant access to views, functions, etc depending on the requirements), and then grant that role to your user.
    Justin

  • Vertical scroll ONLY

    Hi,
    I'm trying to make a JTextArea scrollable in vertical direction only. I've not found even one solution on this forum and many others.
    AWT version of JTextArea (ie TextArea) allowed vertical or horizontal scroll only, simply with constants given to the constructor. But in Swing version (ie JTextArea), nothing... :-o
    My JTextArea used word-wrap, so that's why I don't want a hrz scroll, cause when i've got such a both-direction-scroll, word-wrap is no more required since JTextArea width increased...
    I tried this :
    JScrollPane scrollPane = new JScrollPane(textArea,
         JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
         JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);of course, even if the horz scrollbar was no more visible, the jtextarea width was still extended.
    I just want something like a Word document, like a simple textarea on a web page, and so on...
    so I tryed to force the textarea width to match the viewport width with a "resize-listener" :
    scrollPane.addComponentListener(new ComponentAdapter()
      public void componentResized(ComponentEvent e)
        Dimension dim = new Dimension(scrollPane.getViewport().getWidth(),
         (int)textArea.getPreferredSize().getHeight());
        textArea.setPreferredSize(dim);
        textArea.revalidate();
    });it looks better but now my vertical scrollbar doesn't scroll the entire document (the scrollpane thinks textarea is smaller than it is) this is surely due to the line wrap, but I don't know how to deal with it...
    please help !
    many thanks in advance :)

    This is what i do, and it usually works:
    list = new JList(aListOfItems);
    scrollPane = new JScrollPane(list);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);          
    scrollPane.setMaximumSize(new Dimension(160,200));
    I've sometimes found that if i fail to set the scrollpane's size, it does not come up on screen properly, so maybe that's your problem.
    By the way, there are 6 arguments that the setHorizontalScrollBarPolicy / setVerticalScrollBarPolicy method can take:
    JScrollPane.HORIZONTAL_SCROLLBAR_NEVER
    JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS
    JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED
    JScrollPane.VERTICAL_SCROLLBAR_NEVER
    JScrollPane.VERTICAL_SCROLLBAR_ALWAYS
    JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED
    It's pretty obvious what they mean.

  • JScrollPane - change vertical scroll-bar

    I am developing an application to be run on a touch-screen monitor. The customer has asked that I make the vertical scroll-bar on the tables easier to use. How do I set the width of the scroll-bar(s) in a JScrollPane?

    Do you want to set the width of all vertical scroll bars (and in that case, probably also the height of all horizontal scroll bars too) OR the width of one specific scroll bar of one specific scroll pane?
    db

  • Problem with Vertical scroll in table control

    Dear All,
    I am facing a problem with table control in module pool program. currently it displays 6 lines, but it does not display the vertical scroll button, even though when I fill data in the six rows and hit enter.
    I have set the vertical scroll option on the table control properties also.
    Can someone help me by sending some sample code?
    Thanks,
    Amit Goyal

    HI Amit ,
        If you have already selected the properties of vertical and horizontal scroll bar then no other operations needed .. if the number of rows increases then that of the table control , you will automatically see the Vertical scroll in your table control ..
      if still you dont see it then write back ..
    Reward if helpful !
    Thanks
    Ranjita

  • Vertical scrolls only one direction

    First, I found the vertical scrolling was in reverse.  After going through system preference->mouse and check the "move content in the direction of finger movement when scrolling or navigating" I got it to move to the direction I want (i.e. as before).
    Now for some reason, I can only scroll to one vertical direction regardless how I rotate the mouse center button.  It is so annoying that I have to click on the vertical bar and move it while holding the mouse down.  Any help on fixing this is appreciated.

    I fixed it, all I need to do is press the little center button down hard while rolling it around.  Maybe there was some dirt stuck in the ball.  I am good now.

  • How can i create a ScrollPane with vertical scrollbar only ?

    As title,
    Thank you very much !

    class MyPanel
       public Dimention getPreferredSize()
          return new Dimention(width, height);
    ScrollPane sc;
    MyPanel pan;
    sc.add(pan);A scrollpane has an outer size, and a client size. The client size (the inside) of a ScrollPane might be bigger than the outside (its magic isnt it?) The client size is adjusted automatically by the ScrollPane to fit the value returned from the client Components getPreferredSize();
    By overriding the client components getPreferredSize(), you adjust the inner size of the Scrollpane. When its inner width is small enough, the horizontal scrollbar will disapear if you use scrollbars as needed policy.

  • Help:Jtextpane in Jscrollpane , the vertical scroll bar  at bottom

    Immediate help needed if possible.
    The scrollpane that contains the textpane is showing the vertical bar at the bottom of the page even if use :-
    scrollRectToVisible(new Rectangle(0,0,1,1));
    Here is my code:-------------------------
    JPanel panel = new JPanel();
    JTextPane textPane = createTextPane();
    textPane.setEditable(false);
    textPane.scrollRectToVisible(new Rectangle(0,0,1,1));
    JScrollPane paneScrollPane = new JScrollPane(textPane);
    paneScrollPane.setPreferredSize(new Dimension(525, 285));
    paneScrollPane.setMinimumSize(new Dimension(14, 48));
    gc.addCentered(paneScrollPane);
    add ( panel );

    From
    http://search.java.sun.com/search/java/index.jsp?qp=&nh=10&qt=%2Btitle%3Ajtextpane+%2Btitle%3Atop&col=javaforums
    scrollRectToVisible(new Rectangle(0,0,1,1))

  • Vertical Scroll in iTunes 11 Keeps Disappearing

    I'm having a problem with the vertical scroll feature on the righthand side of iTunes 11. It keeps disappearing on me. If I adjust the size of the Itunes window, it'll show up, but only momentarily. Eventually it disappears. I have to re-adjust iTunes's window when I want to use it again.  Also, in the new Expanded View, if an album has more tracks than can be seen in the window at one time, I need the vertical scroll, only it's not there!  Until I re-size the window. But as soon as I click on a track, the vertical scroll disappears. I wouldn't mind it fading away when I'm not using it, but I'd like for it reappear when I need it.
    Is there any way to lock the scroll bar on the right hand side?

    After playing around with iTunes a little, I've figured out a solution. I didn't mention it in my previous post, but I am using iTunes 11 on a MacBook Pro.
    The quickest way to temporarily bring back the vertical scroll bar on MacBook Pro:
    Use the two finger scroll technique on your multi-touch track pad. Do a two-finger tap and the scroll bar will briefly reappear.
    It's funny, your brain gets so used to using iTunes one way that you don't think to use the techniques you use with different programs. My solution almost seems self-evident.
    The scroll bar is everpresent in the PC version iTunes 11 on a PC. I just wish this was the case for Macs. It seems like it scrolls more slowly too.

  • Ibooks 3.1 how to change horizontal scroll into vertical scroll

    update to ibooks 3.1, the scroll mode is changed into horizontal scroll, now in my .epub books it cut so many picture in two parts and display in two pages...how to change , back to vertical mode...

    I find this maybe is the new feature only for books with Asia-Pacific words....english books is right with vertical scrolling mode...but chinese books whit horizontal scrolling mode
    why apple doesn't make a set up to change between this ..

  • Adobe Acrobat Professional X - shows blank dialog boxes with vertical bars

    The file and print screen and the file and properties screen both show mainly blank screens with vertical bars only on them, no text at all.
    Looking around the forum I found it may be a font problem.  Is there a way to know which font or if that is actually the problem and how do you resolve that?
    This is on a Windows 7 - 64bit system with Adobe Acrobat Professional X (10.1.12) installed.
    Thank you.

    Hi brian!
    Please see Re: Blank dialog boxes in Acrobat X Pro
    Let us know if that does the trick!
    Best,
    Sara

  • Trackpoint vertical scrolling & Touchpad deactivation

    Hello Forum,
    i',m new to arch and everything works fine except of my desktop configuration, I'm running kde4 from the official repro.
    I have a Thinkpad T500 and would like to use my Trackpoint with vertical scrolling (same behavior as in windows). I configured /etc/hal/fdi/policy/mouse-wheel.fdi as: http://www.thinkwiki.org/wiki/How_to_co … TrackPoint tells me to do but nothing changed. Here is the content:
    <match key="info.product" string="TPPS/2 IBM TrackPoint">
    <merge key="input.x11_options.EmulateWheel" type="string">true</merge>
    <merge key="input.x11_options.EmulateWheelButton" type="string">2</merge>
    <merge key="input.x11_options.YAxisMapping" type="string">4 5</merge>
    <merge key="input.x11_options.XAxisMapping" type="string">6 7</merge>
    <merge key="input.x11_options.Emulate3Buttons" type="string">true</merge>
    <merge key="input.x11_options.EmulateWheelTimeout" type="string">200</merge>
    </match>
    Any idea how to fix this?
    Another problem is, that i would like to deactivate the touchpad completely, anyone knows how to do this?
    Regards,
    teal

    I have the same mouse-wheel.fdi file on my T61 and it's working. At the risk of stating the obvious, are you sure you have input hotplugging properly enabled and the synaptics driver for this installed? As discussed in these wiki entries:
    http://wiki.archlinux.org/index.php/Beg … otplugging
    http://wiki.archlinux.org/index.php/Xor … otplugging
    http://wiki.archlinux.org/index.php/Touchpad_Synaptics
    Hope that helps, I'm new to this too. I'm not sure how to disable the touchpad.

  • Help with a vertical scroll bar issue with a List component

    hi. i have a basic <s:list> that uses an XMLListCollection as it's data provider and a very basic itemrenderer. when a row in the list is clicked a function gets the list.selectedIndex then populates some text fields with more xml data. that all works fine.. the problem i have is that the vertical scroll bar on the list seems to be "clickable" - just like a row in the list. the scroll bar scrolls normally but when it's clicked the selectedIndex becomes -1 which is not helpful b/c the value -1 is passed to the XMLListCollection.
    any ideas? cheers.

    thanks but still problematic...surely the <s:List> component shouldn't return a value when the scrollbar thumb is clicked? i created a very basic list (see below) and made the list dimensions short enough so that there is a vertical scrollbar and found that when the scrollbar thumb is clicked the trace(event.currentTarget.selectedIndex) returns a number. that's annoying b/c i just want a selectedIndex value for a row that is clicked not the scrollbar.
    any ideas to get around? cheers
    <fx:Script>
    <![CDATA[
    protected function list1_clickHandler(event:MouseEvent):void
    trace(event.currentTarget.selectedIndex);
    ]]>
    </fx:Script>
    <s:List x="162" click="list1_clickHandler(event)" y="276" labelField="@label" width="144" height="153">
    <s:dataProvider>
    <s:XMLListCollection>
    <fx:XMLList xmlns="">
    <node label="one"/>
    <node label="two"/>
    <node label="three"/>
    <node label="four"/>
    <node label="five"/>
    <node label="six"/>
    <node label="seven"/>
    <node label="eight"/>
    <node label="nine"/>
    <node label="ten"/>
    <node label="eleven"/>
    </fx:XMLList>
    </s:XMLListCollection>
    </s:dataProvider>
    </s:List>

  • Vertical scroll bar in table control with wizrads

    Hi,
      Im working on a table control with a customised table. I created a table control with wizards. But vertical scroll bar is not working. How can i invoke vertical scroll bar and can any one provide the code for the all the operations on a table control like save,find,find next,change....Thanks in advance.
    Avinash

    Hi Avinash
    move the records number of your internal table into field LINES of tablecontrol. So you should change the code generated by wizard in PBO, for example create a new module:
    PROCESS PBO
    MODULE SET_DATA_TO_T_CTRL.
    LOOP..
    ENDLOOP.
    MODULE SET_DATA_TO_T_CTRL.
       DESCRIBE TABLE ITAB LINE SY-TABIX.
       <TABLECONTROL>-LINES = SY-TABIX.
    ENDMODULE.
    Max

  • Keep vertical scroll bar still y JScrollPane

    Hello all!
    I have got a JTable added into a JScrollPane, which scroll bars are always shown.
    I have to repaint the JTable each 3 seconds and I would like to keep the vertical scroll bar in its original position, for example if I am watching row 24 of the JTable when the JTable is repainted I would like the vertical scroll bar to be in the same position as it was before repainting because now the vertical scroll bar is repainted always at the top...
    With the horizontal bar it works, the bar does not move from its previous state when the JTable is repainted...
    Any idea of what is happening?
    Thanks in advance :)

    This would do for u! ... do it after you have updated the table with the new rows... if you are not using the default table model then you can still get the row count through your JTable object ...
    This part moves the scrollbar to the last row coz im doing "myDefaultTableModel.getRowCount()-1", you can keep the current row index in an instance level variable bjust before refreshing the table and use it in this.setRowSelectionInterval() method ...
    this.setRowSelectionInterval(myDefaultTableModel.getRowCount()-1, myDefaultTableModel.getRowCount()-1);
    this.setColumnSelectionInterval(1, 1); //didnt need any specific column coz I wanted the row basically..
    this.scrollRectToVisible(this.getCellRect(this.getSelectedRow(), 1, true));This basically selects the given row and then moved the scrollbar over to that point as well ...
    OR, here's another alternative!! you can also get the current scrollbar value similarly jsut before refreshing and pass that on to this method ...
    this.jScrollPane1.getVerticalScrollBar().setValue(jScrollPane1.getVerticalScrollBar().getValue());Hope it helps...
    Cheers!
    Asim

Maybe you are looking for

  • (HP C4280) after ink replace ask for alignment page but will not recognize

    printer worked for several ink replacements but now keeps asking for alignment page and after printing page and scan it does not see it so have to cancel scan everytime I want to make a copy. works fine to print from the computer tried to reboot and

  • Research on the Security of NGDC Based on ASP

    Research on the Security of NGDC Based on ASP Zhang Li Gong Jianya Zhu Qing Key Words active server pages (ASP); national geospatial data clearinghouse (NGDC); geographic information system (GIS); Internet Abstract On the basis of the authors? experi

  • My firefox will not work with win8.1

    Firefox worked well on my Win8 quad core while Microsoft Explorer constantly crashes. After upgrading to this new Win8.1 today, Firefox will not connect and basically acts as if there is no internet connection at all.

  • Error Stack Table

    Hello Experts, In SE16, when i am trying to see the contents of an error stack table, it is saying that: "this table does not exist yet in the library". But i thought whenever we create a DTP, the error stack and the corresponding table gets generate

  • InputVerifier and JOptionPane help please

    I am trying to create an application and require to validate input fields. I have successfully written the code to use the InputVerifier class to validate the input but want to use a JOptionPane dialog to notify errors. This doesn't seem to work as t