![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Sep 2007
Posts: 6
Rep Power: 0
![]() |
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. |
|
|
|
|
|
#2 |
|
Expert Programmer
|
ok, first of all do you know any java?
__________________
|
|
|
|
|
|
#3 |
|
Newbie
Join Date: Sep 2007
Posts: 6
Rep Power: 0
![]() |
Yes. i know java. were studieng now on using Joption pane..
|
|
|
|
|
|
#4 |
|
Expert Programmer
|
__________________
|
|
|
|
|
|
#5 |
|
Professional Programmer
|
L to the O to the L
__________________
http://www.kevinherron.com/ |
|
|
|
|
|
#6 |
|
Expert Programmer
|
what do you find so funny andro? I said it MIGHT be useful.
__________________
|
|
|
|
|
|
#7 |
|
Expert Programmer
|
I think andro was addressing the OP, not you, david.
|
|
|
|
|
|
#8 |
|
Highly Adaptive Penguin
Join Date: May 2005
Location: United States
Posts: 251
Rep Power: 4
![]() |
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.
|
|
|
|
|
|
#9 |
|
Expert Programmer
|
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.
__________________
|
|
|
|
|
|
#10 | |
|
Newbie
Join Date: Sep 2007
Posts: 6
Rep Power: 0
![]() |
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:
someone help me please Last edited by big_k105; Oct 1st, 2007 at 2:29 PM. Reason: Added Code Tags |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |