unicode - Java Poker Game - Change diamonds and hearts to red -


I am working on a poker game in Java. I would like to know that to make the symbol of diamond and heart red instead of filling the white, because I can not find it in the Unicode list.

EDIT: I would like to know how to paint the symbols in red to red.

This is my code so far:

  import java.awt. *; Import java.awt.event. *; Import java.util. *; Public Class PokerHand Frame Animation ActionListener (button b = new button ("click for new hand") extends; Boolean appointed [] = new boolean [52]; string [] playcored = new string [10]; string [ ] Players = new string [10]; random R = new random (); int drawn; public static zero main (string array []) {pokerhand pH = new pokerhand}; ph.doIt ();} public zero doIt } {// watch for {int ct; (whistle = 0; whistle; = 9; ++ whistle) Loop, which you have written Placardard [CT] tonight = players; [CT] = "";} // Finally loop b.addActionListener (this); this.setLayout (new flow layout); this .add (b); This.setSize (500, 500); this.setVisible (true);} // ends the method method public zero color (graphics g) {g.setFont (new font (zero, 1, 30 G.drawString (Players [0], 60, 100); g.drawString (Placarded [4]); g.drawString (playback [0], 30, 100); g.drawString ("m", 400, 100) 1], 90, 100); G.drawString (player [1], 120, 100); G Dre String (Plierscard [2], 150, 100); G.drawString (players [2], 180, 100); G Dre String (Plarard [3], 210, 100); G.drawString (player [3], 240, 100); G.drawString (Playarsard [4], 270, 100); G.drawString (player [4], 300, 100); G.drawString ("You", 400, 200); G Dre String (Playrackcard [5], 30, 200); G.drawString (player [5], 60, 200); G.drawString (playcases [6], 90, 200); G.drawString (players [6], 120, 200); G Dre String (Playrackcard [7], 150, 200); G.drawString (players [7], 180, 200); G Dre String (Playcaster [8], 210, 200); G Dre String (players [8], 240, 200); Jie Dre String (Plaracard [9], 270, 200); G.drawString (player [9], 300, 200); } Public Zero Functionality (Action Avenue) {int ct; CT = 0; Int card; Int suits; // We draw 10 cards here (CT> Lieutenant; 10) {// drops the loop on one side = RNXInt (52); If (Appointed [pulled]! = True) {// Practice card =% 13 + 1 drawn; Suit = draw / 13; Appointed [drawn] = true; Playcard [CT] = String.wf (card); If (card == 1) {plierscard [whistle] = "A"; } If (card == 11) {playwriter [CT] = "J"; } If (card == 12) {playwriter [CT] = "Q"; } If (card == 13) {playwriter [CT] = "k"; } If (suit == 0) {playersuit [ct] = "\ u2660"; } If (suit == 1) {playersuit [ct] = "\ u2661"; // convert to red heart} if (suit == 2) {playersuit [ct] = "\ u2662"; // convert to red diamond} if (suit == 3) {playersuit [ct] = "\ u2663"; } CT = CT + 1; } // ends}} // ends with the end (); For (int x = 0; x    

If your Unicode font In the hearts, clubs, diamonds and spades symbols, then you need to attract them in the color of your choice. It is similar to attracting any other character in the color of your choice: just setColor Use

Now you should start with the "filled" version of Spades, Hearts, Diamonds and Clubs, they are:

  - Spade: \ u26 60 - Use the 2661 instead of the heart: \ u2665 2661) - Diamonds: \ u2666 (Use 2666 instead of 2662) - Club: \ u2663b   

Then you just do it:

  g.setColor (Color.RED); ("\ U2665") g.drawString;   

And then you change the color, say, the suit (or text for red, black, blue and green color / red / black back in black) If you " Four-color deck ").

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -