I have tried all sorts of code to get a JTextField of width 400 in the centre of the screen and below that a button which is 100 in width. So the button should be in the middle(as close as it can be) of the text feild but it just won't work.
I use TableLayout.PREFERRED and TableLayout.FILL constraints instead of the 0.54 etc.
I don't know anything about TableLayout, but a common way to do layouts is to nest layout managers.
So you could create a JPanel with a FlowLayout that does center alignment. Then you add the button to the panel and add this panel you your table layout. Now the panel should occupy all the space of the cell, but the button will be in the middle of the panel.