5 Replies Latest reply on Aug 1, 2012 9:58 AM by alabala_kiril

    Force redraw of TextField


      made a prototype which contains some TextFields. If I added text in textfield 0 the cursor jumps automatically to textfield 1 and so no. Problem is now, that sometimes the entered letter in a textfield is not displayed. The text was set to the textfield correctly, but the textfield shows only a white area. If the textfield gets the cursor, the content is displayed. Looks like a refresh problem? How can I force the redraw of a textfield?


      Edited by: opfl on 30.07.2012 06:12
        • 1. Re: Force redraw of TextField
          After investigating this...each textfield shows only one letter. I am setting setPrefColumnCount(1) for each textfield. Probably the problem is now, that after insertion of a character in a textfield, the cursor stands one position to the right and the content is not visible. After gaining the focus, the textfield shows its content because of setting the cursor position. How can I set the position of the cursor in a textfield?
          • 2. Re: Force redraw of TextField
            Have you checked the propeties of the TextField, if you have a scenebuilder?
            Check whether the TextFiled is Laid out in the front or the back.
            • 3. Re: Force redraw of TextField
              Have to explain my use case in more detail. I do not use scenebuilder for this. My aim is to create a textfield on which I can style each character. The standard textfield does not support this and the HTMLEditor or WebView I have to deal with the html stuff and the text gets mixed up with html and content.
              So I wrote a little prototype....a Region Contains a HBox in which I create TextFields. One text field for earch character. Now I have to implement some behaviour like arrow keys, delete...
              It works so far, but randomly there are some text fields which are displaying not the character. The text field gets updated when I set the cursor in it.
              But I have observed something with the visually empty text fields. There are some pixels on the left side of the text field. So I suggest that the text field show the right end of the content. E. g. there is "d" in the field....in the case that I see nothing, the zone after the d is shown. If I select the content of the text field, the text field view show the d correctly. I have no idea to say the text field "show me the 1st position of the string". This would be sufficient because in my case there is only 1 character inside the field.
              • 4. Re: Force redraw of TextField
                Got the problem. I set for each text field setPrefColumnCount(1). The text fields are changing their sizes if in the CSS the font size is changed, but sometimes the letter does not fit in the text fields and the effect I described occurs. Tested it with setPrefColumnCount(2) and it work correctly but the text fields are too wide of course.
                • 5. Re: Force redraw of TextField
                  you can use setPrefWidth to set the width of the text fields instead setPrefColumnCount