Results 1 to 5 of 5
  1. #1
    dizzymj17 is offline Member
    Join Date
    Apr 2011
    Posts
    4
    Rep Power
    0

    Exclamation how to create a monopoly board using java?

    Can someone pls help me, i need to create a monopoly board. also how would i go about highlighting the player position on the board( only a 2 player game) plsss help. thanks

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,985
    Rep Power
    9

    Default

    What have you tried? Where are you stuck?

    The gist: extend JPanel, override paintComponent(), draw whatever you want.

    I read "plsss" like a villainous cartoon snake. Best to stick to actual words, as there are plenty of people here who don't speak English as a first language. And those who do probably view text-message style abbreviations as lazy.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    dizzymj17 is offline Member
    Join Date
    Apr 2011
    Posts
    4
    Rep Power
    0

    Default

    ive tried creating a panel with a border layout and then adding 10 buttons to each border, but it looks messy and is not aligned, also some of the squares need to be different sizes.

    can you explain the the paintcomponenet(), i need to be able to recognise each square on the board...would this allow that?

    thanks

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,985
    Rep Power
    9

    Default

    Quote Originally Posted by dizzymj17 View Post
    ive tried creating a panel with a border layout and then adding 10 buttons to each border, but it looks messy and is not aligned, also some of the squares need to be different sizes.
    If you want to go that route, just use a different layout manager. Lesson: Laying Out Components Within a Container (The Java™ Tutorials > Creating a GUI With JFC/Swing)

    Quote Originally Posted by dizzymj17 View Post
    can you explain the the paintcomponenet(), i need to be able to recognise each square on the board...would this allow that?
    Overriding the paintComponent() method allows you to draw whatever you want. You would then use a MouseListener to detect clicks and whatnot.

    Painting in AWT and Swing
    How to Write a Mouse Listener (The Java™ Tutorials > Creating a GUI With JFC/Swing > Writing Event Listeners)
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    dizzymj17 is offline Member
    Join Date
    Apr 2011
    Posts
    4
    Rep Power
    0

Similar Threads

  1. Replies: 0
    Last Post: 03-17-2011, 09:50 PM
  2. Help with JAVA board game
    By corky1501 in forum New To Java
    Replies: 5
    Last Post: 02-09-2011, 03:18 AM
  3. Simple Monopoly Game
    By AtoN in forum Java Gaming
    Replies: 2
    Last Post: 01-24-2011, 02:31 PM
  4. Monopoly
    By Tompakorv in forum New To Java
    Replies: 0
    Last Post: 02-03-2010, 05:32 PM
  5. how to create board in java...
    By zenith in forum New To Java
    Replies: 5
    Last Post: 01-20-2010, 04:42 AM

Posting Permissions

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