title: Add a complex image in the panel, with buttons around it in one customized user interface
body: <p>How can i have this image like below into the <code>slavePanel</code> and on top of that JPanel adjust the <code>JButtons</code> which looks like the image but having buttons correctly wrapped around? (Right now they are shaped in 1 row, 4 column)</p>
  
  <p><img src="https://i.stack.imgur.com/SNN04.png" alt="enter image description here"></p>
  
  <pre><code>  //
    // Shot Gun mover up/down/left/right, middle on is for zoom
    //
    public void GunMover(JPanel configPanel) throws IOException {
  
      // Master Panel - holds everything
      JPanel masterPanel = new Panel();
      masterPanel.setLayout(new SpringLayout());
  
      // Slave Panel - with image background 
      JPanel slavePanel = new Panel();
      slavePanel.setLayout(new SpringLayout());
  
      // Row 1
      final JButton ptzLeft = new JButton("&lt;");       
      masterPanel.add(ptzLeft, BorderLayout.WEST);
  
      // Row 2
      final JButton ptzRight = new JButton("&gt;");   
      masterPanel.add(ptzRight, BorderLayout.CENTER);    
  
      // Row 3
      final JButton ptzUp = new JButton("^");   
      masterPanel.add(ptzUp, BorderLayout.WEST);    
  
      // Row 4
      final JButton ptzDown = new JButton("down");   
      masterPanel.add(ptzDown, BorderLayout.CENTER);    
  
      // How do i add slavePanel this background and add all the JButtons 
      // According to that image shape?
  
      // Layout the panel.
      SpringUtilities.makeCompactGrid(masterPanel,
                                  1, 4, //rows, cols
                                  6, 6, //initX, initY
                                  6, 6);        
  
      configPanel.setLayout(new GridLayout(0,1));
      configPanel.add(masterPanel);   
    }
  </code></pre>
  
  <p><strong>Follow up:</strong> Excellent one from <code>Andrew Thompson</code>  + at-least my broken method</p>
  
  <p><img src="https://i.stack.imgur.com/7ln6M.png" alt="enter image description here"></p>
  
  <pre><code>package test;
  
  import java.awt.*;
  import java.awt.font.FontRenderContext;
  import java.awt.font.TextLayout;
  import javax.swing.*;
  
  public class New extends JFrame {
  
    private static final long serialVersionUID = 1L;
    private ImageIcon errorIcon =
            (ImageIcon) UIManager.getIcon("OptionPane.errorIcon");
    private Icon infoIcon =
            UIManager.getIcon("OptionPane.informationIcon");
    private Icon warnIcon =
            UIManager.getIcon("OptionPane.warningIcon");
  
    public static void main(String[] args) {
      SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
          New t = new New();
        }
      });
    }
  
    public New() {
      setLayout(new BorderLayout());
  
      JPanel slavePanel = new NewPanel();
      slavePanel.setLayout(new GridLayout(0, 2, 4, 4));
      add(slavePanel);    
  
      JButton button = new JButton();
      button.setBorderPainted(false);
      button.setBorder(null);
      button.setFocusable(false);
      button.setMargin(new Insets(0, 0, 0, 0));
      button.setContentAreaFilled(false);
      button.setIcon((errorIcon));
      button.setRolloverIcon((infoIcon));
      button.setPressedIcon(warnIcon);
      button.setDisabledIcon(warnIcon);
      slavePanel.add(button);    
  
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      pack();
      setVisible(true);
    }
  }
  
  
  package test;
  
  import java.awt.*;
  import java.io.IOException;
  import java.io.InputStream;
  import javax.imageio.ImageIO;
  import javax.swing.*;
  import javax.swing.border.Border;
  
  public class NewPanel extends JPanel {
  
    private Image imageGui;
    private static Dimension screen;
  
    public NewPanel() {
      try {
        imageGui =
                ImageIO.read(
                (InputStream) NewPanel.class.getResourceAsStream(
                "/image/ptz.png"));
      } catch (IOException e) {
        e.printStackTrace(System.err);
      }
  
      Border border = BorderFactory.createEmptyBorder(11, 11, 11, 11);
      setOpaque(true);
      setBorder(border);
      setFocusable(true);
      setSize(getPreferredSize());
      revalidate();
      repaint();
      setVisible(true);
    }
  
    public void paintComponent(Graphics g) {
      super.paintComponent(g);
      g.drawImage(imageGui, 0, 0,
              imageGui.getWidth(null), imageGui.getHeight(null), null);
      revalidate();
      repaint();
    }
  
    @Override
    public Dimension getPreferredSize() {
      return new Dimension(imageGui.getWidth(null), imageGui.getHeight(null));
    }
  }
  </code></pre>