Results 1 to 11 of 11
Thread: Displaying a picture
- 11-07-2011, 02:27 AM #1
Member
- Join Date
- Nov 2011
- Posts
- 4
- Rep Power
- 0
Displaying a picture
Hi! I'm a math/biology major who had to take a semester of Java programming. This means I had never seen it before and haven't used it since. I'm currently working on a "game" for kids to help them learn about marine animals. I started with looking around the internet so I could have a really cool game that allowed kids to click buttons and was interesting to look at, and quickly learned that that is way over my head. My next solution was then to write a simple game that would have a picture pop up after every question was either answered correctly or they ran out of guesses. That way they could see the animal I was referring to and it would give a little bit of information. The problem is, I only know how to do things that were taught in a basic java class for math majors. Can someone please tell me how to call up an image off of my computer? Thanks! This is one question done so you can see what I'm talking about:
import java.util.Scanner;
public class Project {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.println("Welcome! It's time to test your knowledge of fish!");
System.out.println("Question 1: What type of camoflauge does the Angelfish use?");
System.out.println("A. Cryptic Coloration");
System.out.println("B. Silvery");
System.out.println("C. Countershading");
System.out.println("D. Eye Spots");
String answer = keyboard.next();
answer = answer.toUpperCase();
int score = 0;
for(int i = 2; i > 0; i--){
if(answer.equals("D") ){
System.out.println("Correct!");
score = score + i +1;
i=0;
}
else{
System.out.println("Oops! Try again");
answer = keyboard.next();
answer = answer.toUpperCase();
}
}
//right here I would want the image to pop up!
System.out.println("Current Score = " + score);
}
}
- 11-07-2011, 03:12 AM #2
Re: Displaying a picture
You will need to write a GUI for this. There are numerous ways to achieve it. I suggest you Google for a GUI tutorial.
- 11-07-2011, 03:42 AM #3
Member
- Join Date
- Oct 2011
- Posts
- 27
- Rep Power
- 0
Re: Displaying a picture
i would suggest downloading netbeans as it had its own GUI builder and then find a tutorial.
-
Re: Displaying a picture
- 11-07-2011, 06:40 AM #5
Senior Member
- Join Date
- Aug 2011
- Posts
- 251
- Rep Power
- 7
Re: Displaying a picture
I asked the same question 1 month ago, and people reccomand me to learn the code itself and not using and gui builder/editor.
I want to thank them, I understand the code and I can build gui interfaces easly.
If you are new to the GUI in java, I would reccomand you to code it by your self, it's not that hard.
- 11-07-2011, 06:46 AM #6
Member
- Join Date
- Nov 2011
- Posts
- 4
- Rep Power
- 0
Re: Displaying a picture
I tried at least 6 tutorials and I couldn't understand them. I don't even know if I was looking at the right tutorials. Is there one that someone suggests? And is there no simple way just to get a picture to pop up?
- 11-07-2011, 02:03 PM #7
Senior Member
- Join Date
- Aug 2011
- Posts
- 251
- Rep Power
- 7
Re: Displaying a picture
- 11-07-2011, 06:03 PM #8
Member
- Join Date
- Nov 2011
- Posts
- 4
- Rep Power
- 0
Re: Displaying a picture
Already tried that one. I feel like people aren't understanding that I have close to no knowledge of the language. I was hoping someone could help me, not tell me to do something I already tried. I'm not being lazy by posting on here. This was just my last ditch effort to be able to do this. Tutorials really didn't help or make sense to me.
-
Re: Displaying a picture
It's not that we aren't trying to help you, it's just that we are unable to help you until you gain the knowledge base necessary to understand our suggestions. Like it or not, learning from tutorials is key, and like any skill it is hard to do at first but easier to do with practice and experience, trust me. The key is not to give up, to keep studying and restudying them. Another option is to engage a private tutor for intense one-on-one instruction. Best of luck!
Last edited by Fubarable; 11-07-2011 at 10:32 PM.
- 11-07-2011, 10:08 PM #10
Re: Displaying a picture
Considering that anything that we posted here would be just repeating what was already said in all those tutorials what makes you think that you will understand our explanations any better? What you need to do is make an attempt. Write some code and when you get stuck post that code here, include error messages, explain fully what the problem is and ask a specific question. Only then can we help you.
- 11-08-2011, 07:04 AM #11
Member
- Join Date
- Nov 2011
- Posts
- 4
- Rep Power
- 0
Re: Displaying a picture
Thanks everyone! I found a different thread that had someone who was able to tell me just enough to do what I wanted to do. I think the problem was that all the tutorials were overwhelming. I definitely can't do anything fancy, but I can get a picture to pop up :) Thanks again!
Similar Threads
-
Getting a picture out of a jar?
By Zman3359 in forum New To JavaReplies: 4Last Post: 02-02-2011, 11:55 PM -
Get screenshot(picture) of own pc
By shekhar2010 in forum New To JavaReplies: 5Last Post: 01-24-2010, 03:48 AM -
picture backround
By safiya in forum NetBeansReplies: 1Last Post: 10-18-2008, 07:13 AM -
Error With Simply Displaying Picture
By JDCAce in forum Java AppletsReplies: 4Last Post: 10-07-2008, 08:09 PM -
Picture help
By deathnote11 in forum AWT / SwingReplies: 13Last Post: 06-03-2008, 05:46 PM
Bookmarks