Access to the scroll pane or TextArea scroll bars

I'm trying to get messages to tell me when the scrollbar reaches the bottom of the text box.  I know that I can do this with vvalueProperty of ScrollPane, but I don't have access to one in the TextArea.  is it possible to get this or know when scrolling has stopped and I can check the location of the scroll?  I have tried the onScrollFinished TextAreas with any success.  Never, he triggered the event except when the papule mouse tried more than scrolling when he was already down.

You can get the ScrollPane via a list of choices. I don't really like to recommend research, but sometimes, there seems to be no other way; and in this case the css structure is at least documented in the reference css.

import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TextArea;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

public class TextAreaScrollTest extends Application {

 @Override
  public void start(Stage primaryStage) {
  final BorderPane root = new BorderPane();
  final TextArea textArea = new TextArea();
  final Label label = new Label();
  root.setTop(label);
  root.setCenter(textArea);
  primaryStage.setScene(new Scene(root, 400, 300));
  primaryStage.show();

  ScrollPane scrollPane = (ScrollPane) textArea.lookup(".scroll-pane");
  label.textProperty().bind(Bindings.format("Vertical scroll at %.3f", scrollPane.vvalueProperty()));
  }

  public static void main(String[] args) {
  launch(args);
  }
}

Be careful when you call textArea.lookup (...). The text box must have applied css styles so that it works. Typically, this means that he was tied to a scene which is displayed in a stadium. (If you move the search above call just before the call to primaryStage.show (), for example, you will get a nice NullPointerException.)

Tags: Java

Similar Questions

  • My screen has become unbalanced and I can't access the scroll bar

    In the last days, the screen on my laptop model Toshiba P100 drifted farther and farther to the right. I can not access the scroll bar. I tried for the quarterback by using the arrows but am having no luck. I've tried several things, including them turn off the computer. I did not install new programs, adding only a few pictures of my photos yesterday

    Given that this problem started a few days ago, do a system restore.

    Choose a date where you did not have this problem as your restore point.

    http://www.howtogeek.com/HOWTO/Windows-Vista/using-Windows-Vista-system-restore/

    Also, if you haven't tried that already, reset your screen resolution:

    http://www.Vistax64.com/tutorials/84291-screen-resolution.html

  • Try to scroll to see the folder of photos. I scroll down and the scroll bar jump upward.

    I want to display an image file.  When I scroll down and drop the scroll bar of the jumps back to the top.  I can't access all files below a few albums.  Until I have a chance to click on the folder to open it, the bar rises to the top.

    Hello CathiVanderhave,

    Please provide the make and model of your PC. In addition, please relay if the problem occurs when you try to view other files. You also try to perform a clean boot to verify if a background program may interfere. To do this, please see the link below:

    http://support.Microsoft.com/kb/929135

    Thank you

  • The scroll bars on a particular site

    A Web site I open often has an annoying bar at the top.  One day, I decided to close it; and when I did, the scroll bars disappeared.  I closed the site and I'm back.  Was back in the bar upstairs, but the scroll bars were not.  I tried everything I can think but cannot retrieve the scroll bars.  Thanks for any help you can offer!

    Hi Mary,

    1. don't you make changes to the computer before the show?
    2. what browser you use to access the site?

    Method 1:

    If you use Internet Explorer, I suggest you check out the link and run the fix it.

    Improve performance and security in Internet Explorer:

    http://support.Microsoft.com/mats/ie_performance_and_safety/

    Method 2: I suggest you to check if the problem persists in mode without modules.

    How to optimize Internet Explorer
    http://support.Microsoft.com/kb/936213/ro

    Note: Reset the Internet Explorer settings can reset security settings or privacy settings that you have added to the list of Trusted Sites. Reset the Internet Explorer settings can also reset parental control settings. We recommend that you note these sites before you use the reset Internet Explorer settings.

    Get back to us and let us know the State of the question, I'll be happy to help you. We, at tender Microsoft to excellence.

  • Disable the scroll bar when the content is less than the viewport?

    Hello

    I have a vertical scroll bar has always shown (JScrollPane.VERTICAL_SCROLLBAR_ALWAYS).
    but I want that it should be disabled when the content in the display is lower at the height of the viewport.

    For example, browser Chrome in Windows: when you open Google, the content of the page is fairly low in height and scrolling in Chrome bar will be disabled. As soon as you have enough content on the page of the scrollbar will be active.

    How can I achieve this?
    Thank you

    Hello

    It isn't really a problem, I just know that it is a limitation of the SWING, (...)
    Almost all app have this behavior; It is not very nice visually.

    I don't have Chrome and haven't seen this problem until now, anywhere (but it is true, I'm way behind in terms of GUI mode).
    The behavior that I'm used to (and which Swing designers apparently supposed to be standard too), which is a scroll bar disappears when the width of the view does not justify it ( SCROLLBAR_AS_NEEDED ). Using SCROLLBAR_ALWAYS implies that you want to the scroll bar, no matter if the width of the merit. How the scroll bar looks like in this case sounds like a look and feel selection instead (I don't have older OSs, but maybe you know an operating system where this behavior is the norm? In this case, Yes, this is a limitation of the corresponding Swing L & F).

    Maybe there is a work around.

    Because this isn't the OS Lebanese armed forces, which can be "manually coded", by listeneing to resize events and thus change the appearance of the ScrollBar.
    Assuming that the "disabled" appearance scroll bar is what you are looking for (no idea, it's just an example, if that do not meet your needs, you can do something else in the placeholder code), here is one, certainly dense enough, workaround.
    Notice how the vertical and horizontal scroll bar is different (I applied workaround only to the latter).

    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    
    public class TestDisableScrollBar extends JPanel
    {
        private static final String SHORT_TEXT = "text";
        private static final String LONG_TEXT = "texttexttexttexttexttexttexttexttexttexttextte";
    
        private static void createAndShowGUI()
      {
            JFrame frame = new JFrame("Demo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JTextArea textarea = new JTextArea(5, 5); // just to take up some space.
            final JLabel label = new JLabel(SHORT_TEXT);
            JPanel view = new JPanel();
            view.setLayout(new GridLayout(2, 1));
            view.add(label);
            view.add(textarea);
            final JScrollPane widget = new JScrollPane(view, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
            widget.getHorizontalScrollBar().setEnabled(false);
            widget.getViewport().addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent e) {
                    widget.getHorizontalScrollBar().setEnabled(
                            widget.getViewport().getWidth()<
                            widget.getViewport().getView().getWidth());
                }
            });
            frame.getContentPane().add(widget, BorderLayout.CENTER);
            JButton alternateText = new JButton("Switch width");
            alternateText.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    label.setText(label.getText().equals(SHORT_TEXT)?
                        LONG_TEXT : SHORT_TEXT);
                }
            });
            frame.getContentPane().add(alternateText, BorderLayout.SOUTH);
            frame.pack();
            frame.setVisible(true);
          }
    
        public static void main(String[] args) {
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
                  }
              });
        }
    
      }
    
  • How to move the scroll bar to the bottom of the screen

    Hello

    I have a problem here that I hope someone on this list could help me to understand.

    Here's the part where my textArea is to:
    < mx:TextArea id = "text2" width = "250" height = "385".
    borderStyle = "none" text = "{book_info}" / >

    It's the variable book_info that I use to generate information to insert into text2:

    book_info = message + "\t" + message2 + "\n";
    var splitText:Array = book_info.split ("null");
    book_info = splitText.join("");
    trace ("\t" + message + message2);

    Text2.selectionBeginIndex = text2.length;
    Text2.selectionEndIndex = text2.length;

    The problem is that when text start to get generated in the text box, the text cursor is always at the beginning and the user must scroll to retrieve the newly added information.

    The code above allows you to be at the end of the text box, by definition Text2 in this case, the text cursor, but I find that I still have to scroll the scroll bar downwards to see the new lines added. Is it possible to add text so that my "scrollbar" position is always at the bottom of the screen? Pointers would be appreciated.

    Thanks in advance.

    Alice

    I think it should be

      private function setMaxVScrollPos():void {
                    text2.verticalScrollPosition = text2.maxVerticalScrollPosition;
                }
    
        book_info += "\n" + selectedName + "\n";
                      callLater(setMaxVScrollPos);
    

    maxScrollPosition is read only

  • How to lock the scroll bar and several tabs to prevent them from scrolling erratically

    I have upgraded to Windows 10.
    Now the fireplace (Yes, it's the latest version) scrolls top down in erratic Web pages.
    I can't control the right scroll bar.
    Even after clicking on it or by moving up and down, either with the use of the touchpad, arrows and arrows at the top / below the scroll bar itself, it moves just everywhere anywhere on the page.
    The same thing occurs when multiple tabs are open. They scroll left and right erratically.
    Help! It's the most boring, frustrating and time consuming.
    I have already searched several forums and blogs, disabled the auto-scrolling and scrolling soft, all to nothing will do.

    On my system, the mouse pad has a mind of its own. So I opened it from the
    settings and OD "disable when mouse available.» No problem now.

  • How can I disable the zoom of the scroll bar feature?

    When I try to use the right scroll bar site zoom in and out. This feature is not useful for me, is it possible to turn it off?
    Thank you.

    You use a touch pad? After you move the pointer over the scroll bar, you use tap/hold/drag to move the 'thumb' scroll bar to the bottom of the page? During this process, the 'thumb' changes usually color - for example, it could be darker than when you just drag the pointer of the mouse around above him. It does not appear that he be chosen successfully?

  • On the right side of the br5owser, there is a scroll bar, the scroll bar is not no matter what a contrast and is almost invisible, can't find it?

    Have seen other issues similar to mine and they can be on the same issue, but they say that the scroll bar disappears, in fact, it's still there but almost invisible. Try to click on it without knowing the exact location to cause the uncontrolled scrolling page. Other issues advised people to restore their browser by default, but that did not help at all. Had this same problem for about 6 of the latest versions of firefox, all say in the 1930s versions. I tried adding contrast high Windows as an experiment, but that did not help at all either. Been trying help for awhile and just now decided to ask myself a question as the other speakers may have given or answerers may think it is resolved.

      In searching through help files it has led me to find a space based theme for the browser that I enjoy, but does not solve issue of course, so... all is not lost. Took a jpg of the image of the browser that shows the issue and am trying to upload it but looks like it is stuck in upload mode. Ugh "high speed" , anyhow maybe it uploaded and is not showing, the bar on the right is about 3/4 of the way down the side if you can see it, almost invisible.
    

    Core-el,

    Thank you
    Discovered it was my own question of system, but had to talk with others, before I realized how in the absence of mind my question was. Old system had control of contrast on the screen, and they have been set to 4 digits off the coast of 50 / 100. I wouldn't think that little would make a difference, because it doesn't have in all the other use of the browser, but he did. So was my system, actual physical hardware settings. Sorry for wasting your time but thanks much for all of your thoughts.

  • After I updated to Firefox, the bar indicator in the scroll bar is missing.

    The small bar in the scroll bar that indicates how far to the bottom of the page that you are is missing. Sometimes, it appears when the page loads first, but disappears if I click anywhere in the scroll bar (on the top or down arrows, on the indicator, or anywhere in the length of the bar.

    See also this bug report:

    • bug 1066934 - FF32: skin scrollbars thumb disappear after scrolling from one page to the specific zoom percentage (different themes FF)

    Please, do not comment in bug reports
    https://Bugzilla.Mozilla.org/page.cgi?id=etiquette.html

  • I have the Scroll Bar in bookmarks are gone now can it get replaced

    The scroll bar is now missing when I click the icon of bookmarks instead he is just an arrow down. I have a lot of Favorites and now it takes forever to get to the bottom where are my most recent. Please add the scroll bar option.

    Thank you!

    I finally found it. After clicking on the bookmark icon, you must now click on view bookmark Sidebar and it takes you to the bookmarks that I am used to. (when you click the bookmark icon it used to take you directly there)
    I hope this helps someone else!

  • When I use Firefox to display Oracle WebLogic EM, Firefox will not display the scroll bar on some pages. But Google Chrome.

    It is a problem specific to Oracle Web Logic EM.

    In our society, we use the logical Web as a basis for the application server.

    In the EM logic web server, users can use a Web Logic EM (EM is a portal to view processes on Web Logic application) to verify the data.

    I found when I use EM to check online XML, sometimes the page does not appear the scroll bar.

    If I use Google Chrome or Opera, and do the same thing, the page will display scroll bar.

    But I need Firefox because it is my main browser.

    How to overcome this issues?
    And how to prove?

    Hello, cor - el

    Please, please read this thread first:
    https://support.Mozilla.org/en-us/questions/976345

    I found there is that some people have the same problems.

    I check the data of the source code viewer, the data displayed are "pure XML.

    So my question is "pop-up windows display XML data in Firefox.

    I searched the KB and found an expert suggests a whole 'dom.disable_window_open_feature.scrollbars', 'true '.

    This solution not solve my problem.

    And thank you once again, cor - el.

    I can give up google chrome forever.

  • How can I get the scroll bar of firefox on the right side of my screen to stay?

    The scroll bar appears, but he goes with this version. I would stay permanently.

    On MAC OS X

    SYSTEM Goto PREFERENCES > GENERAL > display the scroll bar > choose "always."

  • scheck selection boxes are not displayed in the window options, nor does the scroll bar - why?

    Firefox is very erratic running. Scrolling is choppy at best. Usually, rocking it and descend is too far or no movement at all.
    Also, the scroll bar is black and there is no visible grab buttons to go up or down. Up and down arrows at the top of the bar are also blacked out.
    Selection boxes do not appear in tools, Options. Therefore, it is very difficult to make the custom choices.
    There is a significant delay after clicking 'OK', 'Cancel' or 'Help' buttons-, in fact, other buttons.
    I have 2 Add-ons 'All-in-one Side Bar' and 'Last Pass', no more.

    If I open firefox in safe mode all these problems disappear. Everything moves smoothly and check boxes appear.

    Have you tried to change the default Firefox theme, if you are using another theme?

    Have you tried disabling hardware acceleration?

    All this is in the article link I posted.

    Find out what steps to follow when the problem occurs in Mode without failure of Firefox, according to your original question and follow the links in the next section of the article.

    See also - https://support.mozilla.org/en-US/kb/troubleshoot-and-diagnose-firefox-problems

  • How can I get the scroll bar to go to the top or the bottom of the page with a right click command?

    When I right click on the scroll bar nothing happens. I have to repeatedly turn the mouse wheel to get to the top or the bottom of the page. I just changed from the Explorer. I'm used to be able to do this. It's a lot less frustrating and time-consuming. I hope someone can help. Thank you.

    Unless an extension (to my insue) provides this functionality, there is no context for that Menu item. Press the keys Home and end the keyboard for up to the top and down.

  • On all websites, buttons at the top don't work, such as the sign in and sign buttons. Also the scroll up button doesn't work. I click on the scroll bar to move upward. I just upgraded to Firefox 901 and it does not solve the issue.

    If a button is in the top 24 mm of a web page, it does not. This includes the scroll bar. If one button operation below that is introduced in this area, it stops working. The dead zone is across the entire screen. I've upgraded to Firefox 9.0.1 and it did not fix the problem. Think that question may have started after I installed a program called Babylon and it installs a browser bar. Deleted the program and the bar of the browser, but did not affect the dead zone.

    Hello

    Please see this.

Maybe you are looking for