Hey everyone. I’m trying to make a swing GUI with a button and a label on it. im using a border layout and the label ( in the north field ) shows up fine, but the button takes up the rest of the frame (it’s in the center field). any idea how to fix this?
Share
You have to add the button to another panel, and then add that panel to the frame.
It turns out the BorderLayout expands what ever component is in the middle
Your code should look like this now:
Before
Change it to something like this:
Before/After
Before http://img372.imageshack.us/img372/2860/beforedl1.png After http://img508.imageshack.us/img508/341/aftergq7.png