Ask Experts Questions for FREE Help !
Ask
    mohammed_BEY's Avatar
    mohammed_BEY Posts: 1, Reputation: 1
    New Member
     
    #1

    Sep 22, 2015, 06:09 AM
    Textfield property
    Hello,
    I am working on a project made in Java. I want that the width of the textfield change dynamicaly with the text.
    This is the code I used it and longChar (String str) return a double according the length of the string 'str'.
    The problem: the textfield doesn't show what I am writing even the width changes.


    Can any one hepls me ?
    Thank you.


    tField2.textProperty().addListener((ObservableValu e<? Extends String> ov, String t, String t1) -> {
    tField2.setPrefWidth(longChar(tField2.getText()));
    });
    CravenMorhead's Avatar
    CravenMorhead Posts: 4,532, Reputation: 1065
    Adult Sexuality Expert
     
    #2

    Sep 22, 2015, 09:58 AM
    The width changes but the text doesn't show up. The problem is likely that you changed the path the code follows when you change the field.

    Example:

    User presses key-> internal string changes -> field redrawn with new text
    Could have been changed to:
    User presses key -> internal string changes -> field redrawn with new width.
    Where you want:
    User presses key -> internal string changes -> field redrawn with new width && field redrawn with new text.

    Look at your code to see if you need to call the update text or redraw or whatnot.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Laws protecting property owners when mortgage company moves mobile home off property [ 3 Answers ]

My mother had a mobile home on our property and she recently passed away. There is a screened porch attached that my husband and I paid to have built. There is hard stucco all around the bottom of the home that will have to be broken up before the home is moved. The mortgage company wants to come...

Is property bought with heneritance money considered community property in Texas? [ 0 Answers ]

My step mother purchased property with monies that was left to her by her father. It was raw land at the time. There have been improvements made to the property by my father. Is it now considered community property? Is there a deed that would make it not community property?

Property taxes put in my name by seller resinding on property who owns the house [ 3 Answers ]

Property taxes put in my name because seller resinded as owner who legally owns the house

Do I need to pay any real estate property taxes to the IRS on foreign property? [ 1 Answers ]

I'm a US Citizen with real estate property in another country. I currently reside on the US. The properties are currently rented. Do I need to pay any real estate property taxes to the IRS? I know I should include this income in my tax return. But is there any tax for owning the property that I...

Landlord and loose dog on leased property, doesn't property go with the lease house? [ 31 Answers ]

I lease a house that has a front yard and a backyard and a legal apartment off to the side. My landlord and his dog live in his apt in the garage that I do not think is legal. When we moved in he told us he would be moving in a few months. Before he moved he let his big german sheperd mix run...


View more questions Search