Show image from comboBox selected

  • Follow


I want to show a card image in label of a panel.  I try to create
three array:
                 public String[][] CardStrings
		       = {{ "as", "2s", "3s", "4s", "5s", "6s", "7s", "8s", "9s",
"ts", "js", "qs", "ks" },
		          { "ah", "2h", "3h", "4h", "5h", "6h", "7h", "8h", "9h",
"th", "jh", "qh", "kh" },
		          { "ac", "2c", "3c", "4c", "5c", "6c", "7c", "8c", "9c",
"tc", "jc", "qc", "kc" },
		          { "ad", "2d", "3d", "4d", "5d", "6d", "7d", "8d", "9d",
"td", "jd", "qd", "kd" }};
	public String [] strSuit = {"Spades", "Hearts", "Diamonds", "Clubs"};
	public String [] strNum = {"Ace", "2", "3", "4", "5", "6", "7", "8",
"9", "10", "Jack", "Queen", "King"};

Then, one JcomboBox1 load strSuit[] & another one JcomboBox2 load
strNum[], it record its index and so I use Actionlistener to hear
e.getSource() any change.  For example, I choose (Hearts, 2) that may
comboBox1.getSelectedIndex(1) & comboBox2.getSelctedIndex(1).  The
question is how to combine 2 index to point string "2h" that load my
card image from img folder




0
Reply taingaukwai 3/6/2008 10:01:22 AM


0 Replies
630 Views

(page loaded in 0.097 seconds)

Similiar Articles:













7/24/2012 3:49:27 AM


Reply: