website header Blogger Guwl

Open Question: Call a picture into a Choose Your Own Adventure Story created in Java?

I am trying to create a choose you adventure story in Java and I want to add pictures to go along with my story. I created a button: public class JButtonIcon { public static void main(String[] a) { JFrame f = new JFrame("Cake!"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton b = new JButton(new ImageIcon("H:\\My Pictures\\cake.jpg")); f.getContentPane().add(b); f.pack(); f.setVisible(true); } } The button displays the picture of a cake. What I want to know now is how to get the picture to pop up when the user goes through the story WITHOUT stopping the program. So, say the user decides "to attend a birthday party". My program is based off of one large class with a ton of nested if else loops. So, the choice to attend the birthday party should take the user to a new set of senarios to choose from. When the user chooses to go to the birthday party, I want the picture of cake to pop up then go away, allowing the user to continue on with the program. How in the world do I do that? Sorry if this question is worded stupidly or even if the entire question is stupid-- I am total novice and have been self-teaching myself for a while.
Home - Privacy Policy