I cant seem to set a custom position of a button to JPanel. It always adds the button at the top left, and continues right. I also have a background image in place, which makes matters a bit more difficult. The Frame looks like this: imageshack.com/a/img838/3240/ez6l.png My code is:
private JFrame mainframe =  new JFrame();
public void main()
    {
    mainframe.setLocation(400, 150);
    mainframe.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    mainframe.setVisible(true);
    mainframe.setSize(800, 600);
    JPanel menupanel2 = new JPanel();
    JPanel MusicPanel = new JPanel();
    mainframe.setResizable(false);
    mainframe.setContentPane(new JLabel(new ImageIcon("src/res/LED0.png")));
    mainframe.setLayout(new FlowLayout());
    menupanel2.setBackground(Color.black);
    JButton PlayButton = new JButton("Play");
    PlayButton.setBackground(Color.green);
    JButton highscores = new JButton("Highscores");
    highscores.setBackground(Color.MAGENTA);
    JButton CustomButton = new JButton("Custom Shapes");
    CustomButton.setBackground(Color.orange);
    JButton HelpButton = new JButton("Help");
    HelpButton.setBackground(Color.red);
    JButton AboutButton = new JButton("About");
    AboutButton.setBackground(Color.yellow);
    final JButton MusicButton = new JButton("music");
    MusicButton.setPreferredSize(new Dimension(50, 50));
    CustomButton.setPreferredSize(new Dimension(140, 40));
    PlayButton.setPreferredSize(new Dimension(140, 40));
    HelpButton.setPreferredSize(new Dimension(140, 40));
    AboutButton.setPreferredSize(new Dimension(140, 40));
    highscores.setPreferredSize(new Dimension(140, 40));
    mainframe.add(menupanel2, BorderLayout.NORTH);
    mainframe.add(MusicPanel, BorderLayout.SOUTH);
    menupanel2.add(PlayButton, BorderLayout.NORTH);
    menupanel2.add(CustomButton, BorderLayout.NORTH);
    menupanel2.add(HelpButton, BorderLayout.NORTH);
    menupanel2.add(highscores, BorderLayout.NORTH);
    menupanel2.add(AboutButton, BorderLayout.NORTH);
    MusicPanel.add(MusicButton, BorderLayout.SOUTH);
I want to add the button "MusicButton " to the bottom right corner / middle/ or left. If there is a customized way in which you can order JButtons in JPanel, please share. Thanks
 
     
    
 
    
