0

I am trying to use Java FX (in Eclipse). I am building a GridPane using Scene Builder and want to add a TextField to the GridPane which is freely resizable, i.e. isn't constrained by the grid. How do I do that?

  • Explain *freely resizable*! – ItachiUchiha Sep 30 '15 at 18:09
  • By freely resizable I mean the TextField can assume any size, not necessarily equal to multiples of cell sizes. – Maciek Nicewicz Sep 30 '15 at 18:11
  • I think what you are trying to say here is that you don't want your TextField to fill the whole available space of one cell in the grdipane and can decrease/increase its size irrespective of the size of the cell. Is that it? – ItachiUchiha Sep 30 '15 at 18:16
  • Yes, that's it. I want to be able to resize the TextField to, for example, 1.5 times the width of a cell. – Maciek Nicewicz Sep 30 '15 at 18:24
  • You can just make the *MIN HEIGHT* and *MIN_WIDTH* to *USE_PREF_SIZE* in Scene Builder and then drag and set whatever width and height you want for your TextField. – ItachiUchiha Sep 30 '15 at 18:31
  • Thanks. I think you also need to set MAX_WIDTH to USE_PREF_SIZE and then it works. But even though the width can now be arbitrary, the position still snaps to grid. Any idea how to make it arbitrary as well? – Maciek Nicewicz Sep 30 '15 at 18:47
  • Ahh, correct. You cannot arbitrarily move a child inside a gridpane. Though, what you can do is set its *Valignment* and *Halignment* to different values to suit your need. – ItachiUchiha Sep 30 '15 at 18:54

0 Answers0