Java fixed element's position
<p>I need to build BlackJack game as an study project.</p>

<p>I want build it with SWING GUI. What I need it just divide the screen in 2 parts, and then to be able insert elements (in my case it's extended JButton with signed ImageIcon) using absolute (x, y) position relative to specified part.</p>

<p>Something like that:</p>

<p><img src="http://i.stack.imgur.com/vmRMR.jpg" alt="enter image description here"></p>

<p>I came from developing under Android, where you can work with elements in very simple way, and I feel lost in SWING. There aren't AbsoluteLayout or something like that?</p>

<p>Here is one example of my several attempts to this:</p>

<pre><code>    public void run() {
    // TODO Auto-generated method stub
    JFrame  jFrame = new JFrame("Blackjack");
    jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Container pane = jFrame.getContentPane();
    Insets insets = pane.getInsets();

    URL url = ClassLoader.getSystemClassLoader().getResource("10_of_clubs.png");

    BufferedImage bi = null;
    try {
        bi = ImageIO.read(url);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    Image resizedImage = bi.getScaledInstance(128, 186, 0);

    ImageIcon icon = new ImageIcon(resizedImage);

    ImageButton imgButton = new ImageButton(icon);
    imgButton.setPreferredSize(new Dimension(128, 186));

    ImageButton imgButton2 = new ImageButton(icon);
    imgButton.setPreferredSize(new Dimension(128, 186));

    pane.setLayout(new GridBagLayout());

    JPanel headPanel = new JPanel();
    JPanel headPanel2 = new JPanel();

    GridBagConstraints cns = new GridBagConstraints();
    cns.gridx = 0;
    cns.gridy = 0;
    cns.weightx = 0.5;
    cns.weighty = 0.2;
    cns.anchor = GridBagConstraints.FIRST_LINE_START;
    cns.fill = GridBagConstraints.BOTH;        
    headPanel.setBackground(Color.RED);

    headPanel.add(imgButton, cns);

    GridBagConstraints cns2 = new GridBagConstraints();
    cns2.gridx = 0;
    cns2.gridy = 0;
    cns2.weightx = 0.5;
    cns2.weighty = 0.2;
    cns2.anchor = GridBagConstraints.FIRST_LINE_START;
    cns2.fill = GridBagConstraints.CENTER;        
    headPanel2.setBackground(Color.BLUE);

    headPanel2.add(imgButton2, cns2);

    pane.add(headPanel);
    pane.add(headPanel2);


    jFrame.setSize(800, 600);
    jFrame.setVisible(true);
    jFrame.setLocationRelativeTo(null);
}
</code></pre>

<p>That what I get:</p>

<p><img src="http://i.stack.imgur.com/1TslQ.jpg" alt="enter image description here"></p>

<p>Tnx.</p>
