Controlled scrolling in Text area

Hi
Given a particular offset in Textarea.text, I want to scroll
the Textarea instance to a vPosition where the word will be
displayed. The height, width, fontsize, fonttype for the text area
is fixed and it has only plain text associated with it.
e.g. I want to make sure that word "WORDTOSHOW" is displayed
in the visible area of textarea.
"The quick brown fox jumps over the little lazy dog.
WORDTOSHOW. This is a sample text".
I have tried several heuristics e.g. assuming fixed number of
characters in a line but they fail in several test cases.
HB

Sure? Please, can you try this?
Go to this webpage:
http://web.me.com/choprats/ONLINE
You can try to view and scroll an iFRAME and an OBJECT. With Safari, Firefox or Chrome on my Mac there is no problem, but I can't view correctly the iFRAME height on Safari mobile, and is not possible to scroll the Object inserted.

Similar Messages

  • How to dynamicly scroll a text area?

    Hi,
    i put my JTextArea on top of a JScrollPane.
    i want to set the JScrollPane scroll to the end of the JTextArea everytime i do textArea.append(someString);
    is there an easy way of doing this? or i have to program the logic?
    Thanks.

    This question has probably been asked a hundred times. The default behaviour is for the textare to scroll automatically if the following conditions are met:
    a) the caret is at the end of the document
    b) the append is done from the event thread
    If you want more adice then try searching the forum. Using keywords "jtextarea scrolling" would be a good place to start.

  • How to middle text in a text area?

    Can someone tell me how to middle the text (vertically) on a JTextArea? It always starts at the top.
    Thanks to all in advance
    sridhar

    Um, assuming by "middle the text" you mean scroll the text area to the vertical center of the text area:
    1) Enclose your text area in a JScrollPane.
    2) Get the vertical scroll bar of the scroll pane using:
    JScrollBar scrollbar = scrollpane.getVerticalScrollBar();3) Find the middle of the scroll bar using:
    scrollbar.setValue(scrollbar.getMaximum() / 2);

  • Pulling text from a .txt to a scroll pane or text area

    Hi-
    I'm sure there's a way to do this, but I'm not exactly fluent in ActionScript.
    Basically, my whole website's going to be in Flash, but I want to be able to update one page (sort of a news/blog page) without having to edit the Flash file every time. I'm assuming the easiest way to do this would be to set up either a scroll pane or a text box and pull the text in from a .txt file (if there's a better way, please let me know). That way I could continue to add on to the .txt file, and Flash would always pull in the current version.
    So, my issues are:
    1. I have no idea where to start with the code for something like that. Is it a LoadVar? Do I physically put a scroll pane or a text area in the frame and put the action on that, or do I put the action on the frame and have it call up a text area component?
    2. Will the text scroll automatically, or is that something else I would have to add in? I plan on adding to this text file for awhile, so it could end up being a lot of text over time.
    3. Would I be able to format the text in the .txt at all? For instance, if I hit enter to put in a paragraph break, would that register once it's pulled into Flash, or would I have to put in an html paragraph break or something? That may be a dumb question, but as I said, I'm not exactly fluent in ActionScript (or any other programming language for that matter).
    Any help is definitely appreciated!
    Thanks!
    -Geoff

    I recommend you use an xml file rather than a text file for storing your content.  The main reason being that it tends to make thing more easily organizable, as well as easier to differentiate things like titles, contents, links, images, etc.
    You could start off using a TextArea component if you want, just to keep things simple.  If you want to format things you can use the htmlText property rather than the text proiperty when assigning your content.  That will allow you more control of the presentation.
    If you want to take the xml approach, you should search Google for "AS# XML tutorial" where you substitute whatever version you plan to use for the "#".  If you plan to use AS3, there is a good tutorial here: http://www.gotoandlearn.com/play?id=64

  • How can I remove the default right click option of the text Area control?

    How can I remove the default right click option of the text Area control?
    Is there any way to disable this control in any of the text controls available?

    The iPhone does not store email addresses for received mail. The iPhone stores all email addressees for sent mail in a list of previous recipients. The list of previous recipients is not synced with Outlook or any address book, but the list of previous recipients is included with the iPhone's backup which is updated by iTunes as the first step during the iTunes sync process. The auto-addrss feature pulls from your contacts on the iPhone and from the list of previous recipients.
    Different from the Mail.app on a Mac, there is no access to the list of previous recipients on the iPhone to remove a previous recipient from the list, or to add a previous recipient to contacts that is not already entered - not at the present time anyway.
    The only way to purge the existing list at the present time is by restoring your iPhone with iTunes as a new iPhone or not from your iPhone's backup.
    Hopefully access to the list of previous recipients will be included with the iOS 5 update.

  • Problem with adding text area in scroll pane

    hi , i have been facing this funny problem , but cant able to get solution.
    the problem is i am trying to add text area in scroll pane , but when i add textarea in scroll pane using scrollpane.add(textarea) that text area remain disable always. i tried making it enable explicility but that code is not working.

    You don't use the add(...) method for JScrollPane. Use:
    a) new JScrollPane( textArea );
    b) scrollPane.getViewport().setView( textArea );

  • Appending The Scroll Bar to the Text Area

    Hey, im having some serious problems setting the scroll panel to my text area, here is what i have done so far, could anyone offer me a hand please
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class MyPanel extends JPanel implements ActionListener
        private JButton forloopbtn;
        private JButton doloopbtn;
        private JButton whileloopbtn;
        private JTextField inserttxtfield;
        private JLabel insertlbl;
        private JTextArea countingtxtarea;
        private JScrollPane myscrollpane;
        public MyPanel()
            //construct components
            forloopbtn = new JButton ("For Loop");
            doloopbtn = new JButton ("Do Loop");
            whileloopbtn = new JButton ("While Loop");
            inserttxtfield = new JTextField (5);
            insertlbl = new JLabel ("Insert Number To Count To Here");
            countingtxtarea = new JTextArea (5, 5);
            myscrollpane = new JScrollPane();
            //adjust size and set layout
            setPreferredSize (new Dimension (485, 351));
            setLayout (null);
            //add components
            add (forloopbtn);
            add (doloopbtn);
            add (whileloopbtn);
            add (inserttxtfield);
            add (insertlbl);
            add (countingtxtarea);
            add (myscrollpane);
            //add actionlistener
            forloopbtn.addActionListener(this);
            doloopbtn.addActionListener(this);
            whileloopbtn.addActionListener(this);
            //set component bounds (only needed by Absolute Positioning)
            forloopbtn.setBounds (90, 50, 100, 20);
            doloopbtn.setBounds (200, 50, 100, 20);
            whileloopbtn.setBounds (310, 50, 100, 20);
            inserttxtfield.setBounds (320, 20, 30, 20);
            insertlbl.setBounds (135, 15, 185, 25);
            countingtxtarea.setBounds (165, 90, 145, 205);
         

    ive tried to do it again and this is what my code now looks like, still no scroll bar tho
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class MyPanel extends JPanel implements ActionListener
        private JButton forloopbtn;
        private JButton doloopbtn;
        private JButton whileloopbtn;
        private JTextField inserttxtfield;
        private JLabel insertlbl;
        private JTextArea countingtxtarea;
        private JScrollPane scrollpane;
        public MyPanel()
            //construct components
            forloopbtn = new JButton ("For Loop");
            doloopbtn = new JButton ("Do Loop");
            whileloopbtn = new JButton ("While Loop");
            inserttxtfield = new JTextField (5);
            insertlbl = new JLabel ("Insert Number To Count To Here");
            countingtxtarea = new JTextArea (5, 5);
            scrollpane = new javax.swing.JScrollPane(countingtxtarea);
            scrollpane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            //adjust size and set layout
            setPreferredSize (new Dimension (485, 351));
            setLayout (null);
            //add components
            add (forloopbtn);
            add (doloopbtn);
            add (whileloopbtn);
            add (inserttxtfield);
            add (insertlbl);
            add (countingtxtarea);
            add(scrollpane);
            //add actionlistener
            forloopbtn.addActionListener(this);
            doloopbtn.addActionListener(this);
            whileloopbtn.addActionListener(this);
            //set component bounds (only needed by Absolute Positioning)
            forloopbtn.setBounds (90, 50, 100, 20);
            doloopbtn.setBounds (200, 50, 100, 20);
            whileloopbtn.setBounds (310, 50, 100, 20);
            inserttxtfield.setBounds (320, 20, 30, 20);
            insertlbl.setBounds (135, 15, 185, 25);
            countingtxtarea.setBounds (165, 90, 145, 205);

  • I just got an iphone 4 yesterday. I got everything all set up and working great. When I woke up last this morning, my ipod has no sound and the albums covers are all mixed up. I've checked all my settings and volume control. My text sound won't work eithe

    I just got an iphone 4 yesterday. I got everything all set up and working great. When I woke up last this morning, my ipod has no sound and the albums covers are all mixed up. I've checked all my settings and volume control. My text sound won't work either. However, my ringtone works just fine.

    Have you taken the steps recommended in the User Guide:  restart, reset, restore?

  • [FL8] cambiar el color del scroll del componete text Area

    aupi gente
    pues eso,,estoy mirando la ayuda del flash y no doy con la
    solucion
    alguien, lo ha tenido que cambiar d ecolor alguna vez?
    saludos y gracias de ante mano

    Horgykitkat wrote:
    What I found after taking out the heights from the text areas is that I was left with uneven text column lengths (alternating beige areas). So I created a repeatable jpg with the same alternating beiges and put it as the background of the bodyArea tag. Again, if there is a better way, please let me know!
    A repeating background image to 'fake' equal height columns is perfectly ok.
    It won't work IF your page is responsive but it isn't so no problem. If it were responsive a better solution would be to take advantage of the css property display: table; and display: table-cell;
    In reference to your footer background color not showing I would assume you have floated items within the footer container. If so then you need to clear those floated items which allows the footer container to wrap itself around the floated items inside it.
    You would do this by using css - overflow: hidden; - on the parent container which has the floats inside it.

  • Possible to highlight a row in text area which in turn would fire an event?

    I'm making a GUI of which the main portion consists of a large text area. The text area would list problems that our company is experiencing - each row would represent a problem. Each row would give a problem ID and a description of the problem. I want to make it so that when the user clicks on a row (a problem), another dialog box would open which would present possible solutions to the user regarding the problem at hand. How would I write code to highlight a row which in turn would fire an event opening up another box?
    I thought about going about this another way - have a drop down (jcombobox) integrated into each row which the user can choose from but I'm not sure if you can insert a drop down into a text area (and neatly into a row at that!) so I think the former way may be preferable.
    Thanks in advance.
    Regards,
    Paul

    If a java application is required (as opposed to a web-based solution using HTML's linking capabilities) the best approach might be a JList implementation. It could go something like this...
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class ListFrame extends JFrame
       public ListFrame()
          super("JList example frame");
          getContentPane().add(getListPanel(), BorderLayout.CENTER);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          pack();
          setVisible(true);
       private Component getListPanel()
          JPanel panel = new JPanel(new BorderLayout());
          final JList list = new JList(new Object[]
             "List option 1...",
             "List option 2...",
             "List option 3..."
          // This will make sure only one item can be checked at a time.
          list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
          // Handle the selection here.
          list.addListSelectionListener(new ListSelectionListener()
             public void valueChanged(ListSelectionEvent e)
                // No need to go on if this was a deselection.
                if (e.getValueIsAdjusting() || list.isSelectionEmpty())
                   return;
                // This is where you would have to convert the value that's selected into whatever
                // it is you want to display to the user.  This example just puts the text of the
                // selected item into a messagebox.
                Object selectedItem = list.getSelectedValue();
                JOptionPane.showMessageDialog(ListFrame.this, selectedItem);
          list.setVisibleRowCount(5);
          // The scrollpane will control the scrolling of the list (so you can have as many options
          // as you want).  Standard JScrollPane functionalities can be used to control various
          // visual aspects of the list.     
          JScrollPane scroll = new JScrollPane(list);
          scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
          panel.add(scroll, BorderLayout.CENTER);
          return panel;
       public static void main(String[] args)
          new ListFrame();
    }I know this is quite after-the-fact, but I hope it helps (if you hadn't already solved the problem :) )

  • Compare Bluray and Dvd Chapters and Scrolling still text

    Question 1:
    Using PremierePro CS5 to set some Encore-Markers and DynamicLink to Encore to create menu:
    Using the same project, the behaviour is quite different:
    for Dvd : Encore-markers behave like Chapters, so I can use the player remote control to go to next chapter (even it is not defined in the menu)
                   that is very handly function.
    for Bluray : Encore-markes behave like Titles and not Chapters, so I cannot use the player remote control to jump to next Encore-markers
    I just looking for references to understand and do the correct ajustments.
    Thanks
    tt
    Question 2:
    Using PremierePro CS5 to add a still picture and scroll it up in slow motion:
    Using the same project, I understand that Bluray is far better than DVD:
    for Bluray : the scrolling of the still picture is smooth (it's very pleasant with texts too)
    for Dvd : the scrolling is jumpy (texts are dizzy and not readable)
    Is there any fix for that (.....something like PremierePro option to smooth it out a little (result little burry) or ... something like ...deinterlacing ?)
    Thanks
    tt

    POINT 1:
    I will skip DynamicLink for circumventing some issues for sure, but it is so handy and makes me lazy to do things fast.
    So far I am using DynamicLink for updating still images in menu with Photoshop and it's working fine.
    Also I have tried sucessfully modifying some assets using AfterEffect. Yes, there are ressources demanding since I have a skinny 12 Gigs RAM.
    POINT 2:
    I have to be more specific in comparing Encore-Bluray and Encore-Dvd (I am not comparing HD with SD).
    I just want to see the big picture comparison (equivalent between Encore-Bluray and Encore-Dvd) instead of "TRY-AND-SEE"
    Let me explain:
    1. Encore-Marker set in PremierePro-CS5 is consider as Chapter in Encore-Dvd)
    2. The final DVD created: I can use the remote control to jump to next Chapter even the Chapter is not referenced anywhere in Encore-Dvd
    3. Encore-Marker set in PremierePro-CS5 is consider as Title in Encore-Bluray) (the same Encore-Marker)
    4. The final Bluray created: I cannot use the remote to jump because there is only one Chapters but many Titles.
    When I am on the last step, of Encore-CS5-Build-Dvd or Encore-CS5-Build-Bluray, i expect to get the same result when playing the Bluray of Dvd
    with the Player (Home DVD Player or Home Bluray Player and absolutely no PC )
    WHAT ELSE IS DIFFERENT BETWEEN THOSE TWO FORMATS? for the same project in ENCORE-CS5
    (I need that information to explain to the end users)
    for now, I just try-and-see and take notes.
    tt

  • Issues in making label selectable when used with text area

    I have used the following code (which was given in the thread : Re: Making Labels and other controls with text selectable for copy&paste ]
    which shows how to make label selectable with text field. )
    public class TrialArea extends Application {
    >>public void start(final Stage stage) throws Exception {
    >>StackPane layout = new StackPane();
    >>layout.setStyle("-fx-background-color: cornsilk; -fx-padding:10; -fx-font-size: 20");
    >>
    >>Label label1 = (new Label("jqhrjhhhhhhdsfdsfdsfdfdsdsfsdfdsdsdsfsddsdsdfsdfsddsfsfsddsfdsdedsfssdfhhhhhhhhhhhhhhhhhhhhkjhejwqrhjwhj ewjrhewjkrjew ewjhrjewjwke \n qwjkhrjkwerehw \n jkehrkjewhrjkew\njqhrkjhejwqrhjwhj ewjrhewjkrjew ewjhrjewjwke \n qwjkhrjkwerehw \n jkehrkjewhrjkew\njqhrkjhejwqrhjwhj ewjrhewjkrjew ewjhrjewjwke \n qwjkhrjkwerehw \n jkehrkjewhrjkew\njqhrkjhejwqrhjwhj ewjrhewjkrjew ewjhrjewjwke \n qwjkhrjkwerehw \n jkehrkjewhrjkew\n jqhrkjhejwqrhjwhj ewjrhewjkrjew ewjhrjewjwke \n qwjkhrjkwerehw \n jkehrkjewhrjkew\n jqhrkjhejwqrhjwhj ewjrhewjkrjew ewjhrjewjwke \n qwjkhrjkwerehw \n jkehrkjewhrjkew\n jqhrkjhejwqrhjwhj ewjrhewjkrjew ewjhrjewjwke \n qwjkhrjkwerehw \n jkehrkjewhrjkew\n "));
    >>
    >>label1.setWrapText(true);
    >> label1.setPrefWidth(480);
    >>label1.setMaxWidth(480);
    >>layout.getChildren().add(
    makeSelectable(label1)
    );>> Scene scene = new Scene(layout);
    >>stage.setScene(scene);
    stage.show();
    /** @return the passed in label made selectable. */
    private Label makeSelectable(Label label) {
    StackPane textStack = new StackPane();
    TextArea textField = new TextArea(label.getText());>>
    >> textField.setEditable(false);
    textField.setWrapText(true);
    textField.setStyle(
    " -fx-background-color: transparent; -fx-background-insets: 0; -fx-background-radius: 0;"
    );>>
    >>
    // the invisible label is a hack to get the textField to size like a label.
    Label invisibleLabel = new Label();
    invisibleLabel.textProperty().bind(label.textProperty());
    invisibleLabel.setVisible(false);
    >> textStack.getChildren().addAll(invisibleLabel, textField);
    label.textProperty().bindBidirectional(textField.textProperty());
    label.setGraphic(textStack);
    label.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
    return label;
    public static void main(String[] args) {>> Application.launch(args);
    >> }
    }The issue I am facing is that with text area, the scroll bar is visible, which does not go with label. The label is being selected properly, but how to remove the scroll bar?
    Edited by: Amrita Dasgupta on Mar 11, 2012 11:38 PM

    DVD SP is not Flash or Director and it sounds like you using "hotpots" are thinking more along those lines. If someone puts the DVD in a DVD Player they may get rather frustrated having buttons that do not do anything and the navgation is strange
    Also take a look here for some more pitfalls and why another app may be better for you
    http://discussions.apple.com/thread.jspa?messageID=1085629

  • Read-Only text area

    Hi,
    I'm using a text area to display a longer read-only text. It should display only 5 lines and, if the text is longer, it should be scrollable. Works fine as long as I set the attribute Editable to true. But if I set it to No (because it should be read-only), I get the following problems:
    - It does not show only the 5 lines anymore, but the complete text without scrollbars.
    - It shrinks the size of the text area, so that it fits the text inside. You can see that looking at the borders. But I wanted to have the borders at the original size independent of the text.
    Does anyone knows, how to solve that?
    Thanks&Regards
    Matthias

    to the best of my knowledge, if you make it read-only you cannot have the scroll bar enabled. and whatever you explained is the expected behaviour!!
    But, i have a workaround under three conditions:
    1. if you need the scroll bar
    2. if you want the size of it as in the initial state - without disturbing the existing size and format of page
    3. you wish to retain the value
    keep the value of the text area in a temporary object and pass it to the reference attribute on submit of page. (here we are just retaining the value and not making it read-only)
    this helps in keeping the format of page undisturbed!!
    HTH
    Sharma

  • Which event dispatched after text selection done on spark text area in Apple iPad using Adobe Flex 4

    I need to know which event triggered after text selection done in Apple iPad. This way i have done in desktop air app code (mouse events)
    protected function txtEditor_mouseUpHandler(event:MouseEvent):void
                if(txtEditor.selectionAnchorPosition != txtEditor.selectionActivePosition){
                    showNoteToolBar(event);
                    txtEditor.focusEnabled = true;
                    txtEditor.setFocus();
    But in Apple iPad how to achieve through "Touch Event" ? And also i need how to hide all context menu on Spaek TextArea?. Why Touch.End event is not fired after place cursor on text area ?
    Please help me !

    Ok, so I finally got it working but this is not ideal at all. Adobe really needs to give us some direction on how to properly deal with font embedding and TLF now that the release build breaks all functionality with loading runtime fonts and TLF.
    Problem:
    I am embedding collections of fonts (faces) into single family classes. Each individual face is registered with Font.registerFont(). I need to do this because I have to have mixed fonts within text flows - at least according to Alex H's recent blog post.
    Fonts do not display in TLF without doing the following:
    1. GlobalSettings.resolveFontLookupFunction = null;
    2. editor.textFlow.flowComposer.swfContext = ISWFContext(this.getFontContext("AnyFamilyNameFromAnyFontEmbedded", false, false, FontLookup.EMBEDDED_CFF));
    3. Instead of #2, use editor.textFlow.invalidateAllFormats();
    Either #2 or #3 need to be performed. If I have a spark richEditableText control in MXML with defined familes from the loaded fonts. I even tried placing the control into a separate state so it wasn't created until after the fonts were loaded... I still needed to invalidate the formats or set the context.
    The "AnyFamilyNameFromAnyFontEmbedded" does not need to be all of the embedded family names. It only needs to be one of them. Once one is used, all embedded fonts work. Also, I have to use the internal namespace to even get access to getFontContext, another oddity that, in my humble opinion, should never be necessary to create mixed style TLF content.
    My questions are then:
    1. Why am I required to use ISWFContext if I am using Font.registerFont()?
    2. Why is GlobalSettings.resolveFontLookupFunction = null; also required for this to work?
    3. What is the recommended workflow to embed fonts from multiple SWF files into the release build and have it work without having to jump through all these hoops?

  • How do I make a custom Scrollbar Text area in FlashCC HTML5 Canvas?

    Hello,
    I need to make a scrollbar for a long text area. I wonder how can I achieve this with HTML5 canvas in Flash CC2014?
    Thanks,
    Rodrigo

    the text looks ok to me, http://www.kglad.com/Files/forums/test2.html
    but yes, you can scroll a movieclip too.

Maybe you are looking for