How to align JPanel to bottom of JFrame (java swing) -


long story short, i'm making simple audio player in java , starting gui; no events, no functionality of kind of yet. i'm asking how can jpanel buttons (controls), align bottom center of main window (jframe).

here's code.

import javax.swing.*; import java.awt.*; public class tryingtowindow extends jframe {    //buttons public jbutton rewind;  public jbutton play;   public jbutton fastforward;    //the window public jframe ui; public jpanel controls;  //main gui function public tryingtowindow(){  //rewind button rewind = new jbutton(new imageicon ("rewind.png")); rewind.setbackground(color.white); rewind.setfocuspainted(false);  //playbutton play = new jbutton(new imageicon ("play.png")); play.setbackground(color.white); play.setfocuspainted(false);  //fastforward button fastforward = new jbutton(new imageicon ("fastforward.png")); fastforward.setbackground(color.white); fastforward.setfocuspainted(false);  //panel w/buttons controls = new jpanel(); controls.add(rewind); controls.add(play); controls.add(fastforward); controls.setbackground(color.black);  //window ui = new jframe(); ui.setlayout(new flowlayout(flowlayout.center)); ui.setdefaultcloseoperation(jframe.exit_on_close); ui.setsize(400, 140); ui.setvisible(true); ui.setresizable(false); ui.settitle("title"); ui.add(controls);   }  public static void main(string args[]) {  new tryingtowindow();    } } 

the flowlayout() in jframe covers center alignment; covers bottom?

use borderlayout , put panel in borderlayout.south of