Results 1 to 3 of 3
Like Tree2Likes
  • 2 Post By Tolls

Thread: Images (javafx)

  1. #1
    Dr.Strange is offline Member
    Join Date
    Mar 2017
    Posts
    1
    Rep Power
    0

    Default Images (javafx)

    I have a Blackjack homework where i am given a folder with 52 cards (like ace of spades = 1.png; 2 of spades = 2.png; and so forth). I have put these cards in an ArrayList and shuffles them every time the user hits the button Deal. I display the first two cards on the ArrayList on the screen. How do I get the value of the cards shown since these are displayed as images on my pane? I have created another ArrayList and compares each selected card to every content of the new cards ArrayList to get the value. It runs, but does not compute the value of the two cards.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: Images (javafx)

    first two cards on the ArrayList
    If the filenames are on the ArrayList, you could get the names there.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: Images (javafx)

    You would usually build a class that represents a card, with the suit and value and, in your case, the filename for the image.

    If you haven't got that far, then (and this is not good Java) you could produce a Map<String, String> which maps the filename to a description of the card.
    DarrylBurke and benji2505 like this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 6
    Last Post: 12-11-2016, 02:19 PM
  2. JavaFX Book | Learn JavaFX More In Depth
    By SnakeDoc in forum JavaFX
    Replies: 0
    Last Post: 05-17-2013, 11:10 PM
  3. Replies: 0
    Last Post: 11-14-2012, 11:15 AM
  4. JavaFX not able to read images
    By ajeeb in forum NetBeans
    Replies: 4
    Last Post: 02-16-2010, 03:16 PM
  5. JavaFX Script and JavaFX Mobile
    By levent in forum Java Software
    Replies: 1
    Last Post: 01-27-2010, 04:48 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
  •