Welcome! Fandoms in the monopoly include Doctor Who, Sherlock, Merlin, Harry Potter, Lord of the Rings and Narnia. You'll see milestones while coding, errors that I have encountered, an "environmental message" , "computer science and careers" that might relate to this program, and how emerging areas of computer science might benefit from this program. Other things include errors that were encountered, the brainstorming before coding. Ryk, happy reading!
Wednesday, 29 May 2013
Tell me, Harry, what exactly is the function of a rubber duck continued.
This is what I have in my program when I create the JLabel. And nowhere, do I say that I am putting it in the centre.
Object[] possibleValues = { "Dragooon, The Great", "Aslan", "Bilbo", "Luna Lovegood" , "Sherlock Holmes"};
Object selectedValue = JOptionPane.showInputDialog(frame, "What character would you like to be? ", "Character", JOptionPane.INFORMATION_MESSAGE, null, possibleValues, possibleValues[0]);
if (selectedValue.equals("Dragooon, The Great"))
{
characterUser = new JLabel(new ImageIcon("C"+1+".png"));
if (tracing) System.out.println("Dragoon the Great: " + characterUser);
} //end of if statement
else if (selectedValue.equals("Aslan"))
{
characterUser = new JLabel(new ImageIcon("C"+2+".png"));
if (tracing) System.out.println("Aslan: " + characterUser);
} //end of else if statement
else if (selectedValue.equals("Bilbo"))
{
characterUser = new JLabel(new ImageIcon("C"+3+".png"));
if (tracing) System.out.println("Bilbo: " + characterUser);
} //end of if statement
else if (selectedValue.equals("Luna Lovegood"))
{
characterUser = new JLabel(new ImageIcon("C"+4+".png"));
if (tracing) System.out.println("Luna Lovegood: " + characterUser);
} //end of else if statement
else if (selectedValue.equals("Sherlock Holmes"))
{
characterUser = new JLabel(new ImageIcon("C"+5+".png"));
if (tracing) System.out.println("Sherlock Holmes: " + characterUser);
} //end of if statement
So in the method that I add the picture to the frame (it is also in the last post), this is what pops up instead:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment