Results 1 to 3 of 3

Thread: Icon placements

  1. #1
    Yakg is offline Member
    Join Date
    Dec 2010
    Posts
    88
    Rep Power
    0

    Default Icon placements

    Hey I'm making a BlackJack game, and wanted to know if anyone has a good idea of the placement of the cards..
    The computer cards are fine to stay there, but if i'll add the user's cards, they will probably be in the same row, so how could I place them at the bottom?

    I was thinking to create another panel, but the question is if there's any other better solution.

    Thanks.

    temp1.jpg

    temp2.jpg

  2. #2
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,983
    Rep Power
    8

    Default Re: Icon placements

    You can use combination of panels, for example: Create a JPanel that can display a hand of cards. Create two instances of it (computer and player) and place them in another panel with a BorderLayout. Place one NORTH and one SOUTH.

    If you can use 3rd party libraries, consider giving MigLayout a go. If anybody mentions GridBagLayout, punch them in the face and download MigLayout immediately. GridBagLayout was cool 20 years ago because we didn't have anything better.

    Final tip: scetch your game on paper, then with different colors, try to identify various panels and layouts.

    Edit: Mandatory link for shameless MigLayout plug MiG Layout Java Layout Manager for Swing and SWT
    Last edited by SurfMan; 10-23-2017 at 04:29 PM.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  3. #3
    Yakg is offline Member
    Join Date
    Dec 2010
    Posts
    88
    Rep Power
    0

    Default Re: Icon placements

    Quote Originally Posted by SurfMan View Post
    You can use combination of panels, for example: Create a JPanel that can display a hand of cards. Create two instances of it (computer and player) and place them in another panel with a BorderLayout. Place one NORTH and one SOUTH.

    If you can use 3rd party libraries, consider giving MigLayout a go. If anybody mentions GridBagLayout, punch them in the face and download MigLayout immediately. GridBagLayout was cool 20 years ago because we didn't have anything better.

    Final tip: scetch your game on paper, then with different colors, try to identify various panels and layouts.

    Edit: Mandatory link for shameless MigLayout plug MiG Layout Java Layout Manager for Swing and SWT
    I will definitely give MigLayout a shot, it seems more modern.
    Since I want to practice also some of the native options, I was thinking about creating the upper panel, and then a gridlayout panel for placing the cards
    and another panel at the bottom.
    I need now to find out how all the panels can co-exist with each other, but sure it's possible.

    Thanks allot.

Similar Threads

  1. All possible placements of n mirrors in a grid
    By Lucato in forum New To Java
    Replies: 0
    Last Post: 05-06-2012, 12:26 PM
  2. Adding another icon to an icon
    By whateverme in forum New To Java
    Replies: 11
    Last Post: 03-29-2011, 08:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •