Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 30th, 2007, 12:01 AM   #1
bratsercom
Newbie
 
Join Date: Sep 2007
Posts: 6
Rep Power: 0 bratsercom is an unknown quantity at this point
Help. I got a problem in making Java games ..

Help. I got a problem in making Java games ..
i dont know how to start it.. and what are laibraries. and other to call in making java Games..

could Someone Can give me An examPle Of Java Game program.
bratsercom is offline   Reply With Quote
Old Sep 30th, 2007, 12:16 AM   #2
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 572
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
ok, first of all do you know any java?
__________________
Quote:
Originally Posted by DaWei View Post
Well, it's better than Pen Islands url....;)

crawforddavid2006 is offline   Reply With Quote
Old Sep 30th, 2007, 1:21 AM   #3
bratsercom
Newbie
 
Join Date: Sep 2007
Posts: 6
Rep Power: 0 bratsercom is an unknown quantity at this point
Yes. i know java. were studieng now on using Joption pane..
bratsercom is offline   Reply With Quote
Old Sep 30th, 2007, 1:30 AM   #4
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 572
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
This might be useful for you.

http://javaboutique.internet.com/tut...e_Programming/
__________________
Quote:
Originally Posted by DaWei View Post
Well, it's better than Pen Islands url....;)

crawforddavid2006 is offline   Reply With Quote
Old Sep 30th, 2007, 1:41 AM   #5
andro
Professional Programmer
 
Join Date: Oct 2005
Location: California
Posts: 290
Rep Power: 3 andro is on a distinguished road
Send a message via AIM to andro
L to the O to the L
__________________
http://www.kevinherron.com/
andro is offline   Reply With Quote
Old Sep 30th, 2007, 2:12 AM   #6
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 572
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
what do you find so funny andro? I said it MIGHT be useful.
__________________
Quote:
Originally Posted by DaWei View Post
Well, it's better than Pen Islands url....;)

crawforddavid2006 is offline   Reply With Quote
Old Sep 30th, 2007, 2:47 AM   #7
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 837
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
I think andro was addressing the OP, not you, david.
titaniumdecoy is offline   Reply With Quote
Old Sep 30th, 2007, 12:24 PM   #8
Brent
Highly Adaptive Penguin
 
Brent's Avatar
 
Join Date: May 2005
Location: United States
Posts: 249
Rep Power: 4 Brent is on a distinguished road
Just a thought, you might want to learn a bit more Java and become more comfortable with the language before you get into game programming. Alot of times what will happen is people will begin to learn a new language, jump into something over their head, and get intimidated by it. Im not saying your not capable, just take it one step at a time.
Brent is offline   Reply With Quote
Old Sep 30th, 2007, 1:51 PM   #9
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 572
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
I have to agree with Brent. Become very comfortable with Java and as many of the GUI parts of it before you make an actual game.
__________________
Quote:
Originally Posted by DaWei View Post
Well, it's better than Pen Islands url....;)

crawforddavid2006 is offline   Reply With Quote
Old Oct 1st, 2007, 4:47 AM   #10
bratsercom
Newbie
 
Join Date: Sep 2007
Posts: 6
Rep Power: 0 bratsercom is an unknown quantity at this point
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.Properties;
 
 
public class QuizGame extends JFrame implements ActionListener {
	
	Container MyBox = getContentPane(); 
	
	JPanel textareaPanel = new JPanel();
	JPanel buttonsPanel = new JPanel();
	
	JTextArea textarea = new JTextArea(15,30);
	JScrollPane scroll = new JScrollPane( textarea);
	
	JButton Answer1 = new JButton( "Answer 1");
	JButton Answer2 = new JButton( "Answer 2");
	JButton Answer3	= new JButton( "Answer 3");
	JButton Answer4 = new JButton( "Answer 4");
	JButton NextQuestion = new JButton( "Next Question");
	JButton Exit = new JButton ( "Exit");
	String AppExit = "";
	String question = "";
	String answer1 = "";
	String answer2 = "";
	String answer3 = "";
	String answer4 = "";
	String correctAnswer = "";
	String userAnswer = "";
 
	
	public QuizGame() 
	{
		super ("The Quiz");
		setSize(400,500);
		JOptionPane.showMessageDialog(null, "Welcome to \"The Quiz\" PRE-Alpha");
	}
	
	public void GUI()
	{
	 	MyBox.setLayout(new BorderLayout());
 		MyBox.setBackground(Color.black);
 		MyBox.add(textareaPanel, BorderLayout.NORTH);
 		MyBox.add(buttonsPanel, BorderLayout.CENTER);
 	
 		buttonsPanel.setLayout(new GridLayout(2,3));
 		
 		textareaPanel.add(textarea);
 		
 		textarea.setEditable(false);
 		
 		buttonsPanel.setBackground(Color.black);
 		buttonsPanel.add(Answer1, BorderLayout.CENTER );
 		buttonsPanel.add(Answer3, BorderLayout.CENTER);
		buttonsPanel.add(NextQuestion, BorderLayout.WEST);
		buttonsPanel.add(Answer2, BorderLayout.WEST);
		buttonsPanel.add(Answer4, BorderLayout.WEST);
		buttonsPanel.add(Exit, BorderLayout.EAST);
		
		Answer1.addActionListener(this);
		Answer2.addActionListener(this);
		Answer3.addActionListener(this);
		Answer4.addActionListener(this);
		NextQuestion.addActionListener(this);
		Exit.addActionListener(this);
	}
	
	public void Properties()
	{ 
	
		Properties questionProperties = new Properties();
		FileReader questionIn = new FileReader(new File("P:\\Quiz\\QuizGame\\question.txt"));
		questionProperties.read(questionIn);
 

		String question = questionProperties.getProperty("question.txt");
		String answer1 = questionProperties.getProperty("answer.1");
		String answer2 = questionProperties.getProperty("answer.2");
		String answer3 = questionProperties.getProperty("answer.3");
		String answer4 = questionProperties.getProperty("answer.4");
		String correctAnswer = questionProperties.getProperty("answer.correct");
		
		textarea.append(question+"\n\n"+answer1+"\n"+answer2+"\n"+answer3+"\n"+answer4);
	}
	
	
	public void actionPerformed(ActionEvent event)
	{
		if ( event.getActionCommand().equals("Answer 1"))
		{
			userAnswer = answer1;
			if (userAnswer.equals(correctAnswer)) 
			{
				JOptionPane.showMessageDialog(null, "Correct!");
			}
			else
			{
				JOptionPane.showMessageDialog(null, "You're wrong!");
			}
		}
		if ( event.getActionCommand().equals("Answer 2"))
		{
			userAnswer = answer2;
			if (userAnswer.equals(correctAnswer)) 
			{
				JOptionPane.showMessageDialog(null, "Correct!");
			}
			else
			{
				JOptionPane.showMessageDialog(null, "You're wrong!");
			}
		}
		if ( event.getActionCommand().equals("Answer 3"))
		{
			userAnswer = answer3;
			if (userAnswer.equals(correctAnswer)) 
			{
				JOptionPane.showMessageDialog(null, "Correct!");
			}
			else
			{
				JOptionPane.showMessageDialog(null, "You're wrong!");
			}
		}
		if ( event.getActionCommand().equals("Answer 4"))
		{
			userAnswer = answer4;
			if (userAnswer.equals(correctAnswer)) 
			{
				JOptionPane.showMessageDialog(null, "Correct!");
			}
			else
			{
				JOptionPane.showMessageDialog(null, "You're wrong!");
			}
		}
		
		if ( event.getActionCommand().equals("Exit"))
		{
			JOptionPane.showMessageDialog(null, "Thank you for using\"The Quiz\"");
			System.exit(0);
		}
		
		if ( event.getActionCommand().equals("Next Question"))
		{
			JOptionPane.showMessageDialog(null, "Still Working on it!");
		}
	}
 
	public void init()
	{
	  	//
	}
	
	public static void main(String args[])
	{		
		QuizGame object = new QuizGame();
 		object.GUI();
 		object.Properties();
 		object.setVisible(true);
 		
	}
}

Quote:
--------------------Configuration: <Default>--------------------
C:\QuizGame.java:75: cannot resolve symbol
symbol : method read (java.io.FileReader)
location: class java.util.Properties
questionProperties.read(questionIn);
^
1 error

Process completed.
i got this one but it has a problem \..

someone help me please

Last edited by big_k105; Oct 1st, 2007 at 2:29 PM. Reason: Added Code Tags
bratsercom is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming with Java: Tutorial ReggaetonKing Java 7 May 20th, 2008 10:58 AM
Making Games demon101 Visual Basic 9 Apr 20th, 2007 11:41 AM
Java mail problem with attachment tsofras Java 1 Dec 16th, 2005 4:45 AM
Simple, yet annoying problem with Java Beans rross46 Java 4 Nov 7th, 2005 8:16 AM
Java script problem zeotrex JavaScript and Client-Side Browser Scripting 5 Sep 2nd, 2005 5:30 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:28 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC