First, I can't seem to get the image to display. I have the gallows already displaying and I want to get the head (that is the next pic that shows the gallows with the head) to display but its not working.. I believe I have the right code but I'm thinking that I am putting the wrong file path in? I'm using a JOptionPane to double check the image and it always comes up blank. So, I'm clearly not getting the image. Here's what I'm attempting to use for that:
Expand|Select|Wrap|Line Numbers
- if(wrong == true) {
- wrongnum++;
- //JOptionPane.showMessageDialog(null, wrongnum);
- if(wrongnum == 1) {
- ImageIcon icon = new ImageIcon("head.png");
- JOptionPane.showMessageDialog(null,icon);
- jLabel2.setIcon(icon);
- jButton1.setEnabled(false);
- }
- }
Expand|Select|Wrap|Line Numbers
- int chc = 0;
- boolean wrong = false;
- for(int i = 0; i < chw.length; i++){
- if(chw[i] == 'A' | chw[i] == 'a') {
- if(chc == 0)
- {
- chc = i;
- us1Label.setText("A");
- AButton.setEnabled(false);
- wrong = false;
- }
- if(chc == 1)
- {
- chc = i;
- us2Label.setText("A");
- AButton.setEnabled(false);
- wrong = false;
- }