Search code examples
javaswingdynamicjtextfieldwindowbuilder

What does it mean when my jtextfield has "<dynamic>" written instead of the text I imported from a file?


I imported a String ArrayList from a file and I tried to write the first string (position 0) of the array in a JTextField. The word is not on the text field, instead of it, I have the word <dynamic> written there.

Here's the code:

txtTEST = new JTextField();
String title =gl.getGL().getBooks().get(0).getTitle();
System.out.println(title);
txtTESTE.setText(title);

Solution

  • < dynamic > means that this text field has not a static string (e.g "Hello world"). Window builder will show it, when the value of the field is a variable.

    gl.getGL().getBooks().get(0).getTitle();
    

    This is a variable, hence the window builder will show < dynamic >.

    As far as i remember though (i have not used windowbuiler for almost a year), if you give a final variable to the field, window builder will be a able to spot it and show the correct value. Something like

    private static final String HELLO_WORLD = "Hello world!";
    ...
    textField.setText(HELLO_WORLD);