How to join JTextField with JButton?

-1

I want to give my program a better style and I want to link the button with the text box but I can not do it. I want it to look like this.

And I just make it look like this.

Mine is doing it directly with netbeans, the other is done with code directly ...

    
asked by Luis Morales 07.11.2016 в 20:10
source

1 answer

1

It depends on the layout you're using. As you have the window, a FlowLayout may be adequate. FlowLayout has a constructor in which you can pass as parameters the space between horizontal components (hgap) and the components with the lower / upper edge (vgap).

Additionally, it has methods setHgap() and setvgap() to fix those spaces.

    
answered by 07.11.2016 / 20:37
source