Space Game In Java

Hi Java Game Developers
Me and a friend from work developed a game in Java. Its at www.spacemercenaries.com
If you want to play click on play sm, this will load the client applet.
It will also ask you to confirm a certificate, this is because the applet uses sockets to connect to the server and if you view battles it saves a copy of the battle to your machine (the files will be stored in your home directory for the use logged on - to see the directory open the java console and you sould find it there)
If you have any questions or comments please feel free to ask and comment :-)

You should write a JFrame version of the game so it runs faster. Also that means that if your web browser's java plugin doesn't work but you have java installed (like me) then you can still play the game. If you need help porting, I'll do it.
Just a thought.
For free Java Games/Apps and a free tech support, go to my website at
www.freewebs.com/masternerdguy

Similar Messages

  • How can i execute Spaces API in java main class?

    Hi
    I am able to execute Spaces API through portal application. However if i try to execute it in java main class, its throwing an exception
    "SEVERE: java.io.FileNotFoundException: .\config\jps-config.xml (The system cannot find the path specified)"
    oracle.wsm.common.sdk.WSMException: WSM-00145 : Keystore location or path can not be null or empty; it must be configured through JPS configuration or policy configuration override.
    How can i set this path, so that i can execute Spaces API from java main class.
    Need this main class to configure in cron job, to schedule a task.
    Regards
    Raj

    Hi Daniel
    Currently i have implemented create functionality in my portal application using Spaces API, which is working fine. Now the requirement is, i need to implement a "Cron Job" to schedule a task, which will execute to create space(for example once in a week). Cron job will execute only the main method. So I have created java main class, in which I have used Spaces API to perform create space operation. Then it was giving exception.
    Later I understood the reason, as I am executing the Space API with a simple JSE client, its failing since a simple java program has no idea of default-keystore.jks, jps-config.xml, Security Policy. Hence i have included those details in main class. Now I am getting new error,
    SEVERE: WSM-06303 The method "registerListener" was not called with required permission "oracle.wsm.policyaccess"
    For your reference i have attached the code below, please help. How can i use Spaces API in java main method(i mean public static void main(String[] args) by giving all required information.
        public static void main(String[] args) throws InstantiationException,
                                                      GroupSpaceWSException,
                                                      SpacesException {
            Class2 class2 = new Class2();
            GroupSpaceWSContext context = new GroupSpaceWSContext();
            FactoryFinder.init(null);
            context.setEndPoint("http://10.161.226.30/webcenter/SpacesWebService");
            context.setSamlIssuerName("www.oracle.com");
            context.setRecipientKeyAlias("orakey");
            Properties systemProps = System.getProperties();
            systemProps.put("java.security.policy","oracle/wss11_saml_or_username_token_with_message_protection_client_policy");
            systemProps.put("javax.net.ssl.trustStore","C:\\Oracle\\Middleware11.1.7\\wlserver_10.3\\server\\lib\\cacerts.jks");
    systemProps.put("oracle.security.jps.config","C:\\Oracle\\Middleware11.1.7\\user_projects\\domains\\workspace\\system11.1.1.7.40.64.93\\DefaultDomain\\config\\fmwconfig\\jps-config.xml");
            systemProps.put("javax.net.ssl.keyStore",C:\\Oracle\\Middleware11.1.7\\user_projects\\domains\\workspace\\system11.1.1.7.40.64.93\\DefaultDomain\\config\\fmwconfig\\consumer.jks");
            systemProps.put("javax.net.ssl.keyStorePassword", "Test12");
            System.setProperties(systemProps);
            GroupSpaceWSClient groupSpaceWSClient;
            try {
                groupSpaceWSClient = new GroupSpaceWSClient(context);
                System.out.println("URL: " +
                                   groupSpaceWSClient.getWebCenterSpacesURL());
                //delete the Space
                List<String> groupSpaces = groupSpaceWSClient.getGroupSpaces(null);
                System.out.println("GroupSpaces:: " + groupSpaces.size());
            } catch (Exception e) {
    Regards
    Raj

  • How do I get rid of the space game that keeps popping up every time I open Firefox?

    There is a space game that pops up every time I open the internet in Fire Fox. It does not do it in with Google Chrome or Internet Explorer. I have to click "control", "alt" "a" to get it to stop playing every time or it will continually send up little space like ships and make shooting noises (so annoying). I just want it off of there, so I don't have to mess with it. Can you please help me remove it.

    If this isn't on the built-in Firefox home page, it could be caused by an add-on. To rule out one of your extensions is involved, could you try Firefox's Safe Mode? That's a standard diagnostic tool to deactivate extensions and some advanced features of Firefox. More info: [[Troubleshoot Firefox issues using Safe Mode]].
    You can restart Firefox in Safe Mode using either:
    * "3-bar" menu button > "?" button > Restart with Add-ons Disabled
    * Help menu > Restart with Add-ons Disabled
    Not all add-ons are disabled: Flash and other plugins still run
    After Firefox shuts down, a small dialog should appear. Click "Start in Safe Mode" (''not'' Reset).
    Any difference?

  • Want help in developing my first game in java!!

    I want to develop a tetris game in java..can any one help me on this..basically i m new to java programming, i want to know abt the graphical part ..how to make that.. i will code the rest..I want to make an application rather than an applet..

    look at the Java2D demo that comes with the JDK
    it has lots of source code and just about everything you'll need to do in Tetris (technology wise) is in there, except the game logic.
    when you're ready to move into 3D and heavier apps, try this book:
    Practical Java Game Programming
    http://www.amazon.com/exec/obidos/tg/detail/-/1584503262/102-3570681-1096110?v=glance

  • Can I Write a * Game in Java?

    I have noticed loads of topics lately along the lines of "Can I write a quake style shooter in java" or "could I write a mmporg in Java" and similar for almost every style of game. I'd just like to make a quick point on this:
    Java is a programming language. At the stage it has reached now it can do anything any other programming language can do. It's strengths and weaknesses may be different from those of C, C++, Visual Basic, Lisp or whatever other languages people use regularly, but when it gets right down to it Java isn't the problem. If you can design it effectively then you can implement it in any complete language. It may not be easy but it is possible. The answer to this question is invariably yes.
    These forums are far more useful for asking practical questions rather than asking conceptual ones. A better question might be "how would I best start to design a * to be implemented in Java?"

    Yeah thats a good point. I think that Java has been so popular for so long that it can pretty well do anything as long as the designer designs it properly.
    I've made a http web server, and just yesterday I made a pong style game. Java works for almost anything. Take a cruse through the Java Programming forum. People there are using Java to sort money things and everything.

  • Making Games in Java!!!

    hey i want to make a game in java but i want to get a lot more ideas about what the game should be like and what it should do. I want to actually work with someone else to make the game and then we can sell it or something like that. So if anyone is interested just make a reply OR e-mail me at [email protected] thanks.

    hey i want to make a game in java but i want to get a
    lot more ideas about what the game should be like and
    what it should do. I want to actually work with
    someone else to make the game and then we can sell it
    or something like that. So if anyone is interested
    just make a reply OR e-mail me at [email protected]
    thanks.This post is an email harvester's dream.

  • ı  cant  still  play   at  yahoo  games   after  java   upgrade,  why    someone    doesn't  hall  me

    ı  have  mac  book  air   ,  mac  os  mountain  lion   x   8    2    and  java   7   9  is  loaded...ı  cant  play    at  yahoo  games   after  java  upgradede  to   7 9  ,  ı  have  been   writing  here   to  expect  someone  hear me   and  help  me?   is  this   just  for   trade   or    help  customers    to  solve   problems  they  meet...ı   want  apple  professionals    hear   and  help  me  !!!  what  can  ı  do?    all  were   done  properly  but   when  ı   enter  yahoo  lounge   and  attemp  to    join  a  table   ,   it  quits   and    ı  cant  join  then  it  says  error  lodging....can  someone  help  me  ,  pls  urgent  !!!!

    ı  have  mac  book  air   ,  mac  os  mountain  lion   x   8    2    and  java   7   9  is  loaded...ı  cant  play    at  yahoo  games   after  java  upgradede  to   7 9  ,  ı  have  been   writing  here   to  expect  someone  hear me   and  help  me?   is  this   just  for   trade   or    help  customers    to  solve   problems  they  meet...ı   want  apple  professionals    hear   and  help  me  !!!  what  can  ı  do?    all  were   done  properly  but   when  ı   enter  yahoo  lounge   and  attemp  to    join  a  table   ,   it  quits   and    ı  cant  join  then  it  says  error  lodging....can  someone  help  me  ,  pls  urgent  !!!!

  • Getting Error "Not Enough Space" while deploying Java Webservice in AS

    Hello,
    I am trying to deploy a java web-service using OAS enterprise manager but getting an error saying "Not Enough Space". Below are the logs.
    [Jul 21, 2010 12:06:17 PM] Application Deployer for MathAppl STARTS.
    [Jul 21, 2010 12:06:35 PM] Copy the archive to /u02/oracle/product/install/SOAHome1/j2ee/oc4j_soa/applications/MathAppl.ear
    [Jul 21, 2010 12:06:35 PM] Initialize /u02/oracle/product/install/SOAHome1/j2ee/oc4j_soa/applications/MathAppl.ear begins...
    [Jul 21, 2010 12:06:35 PM] Unpacking MathAppl.ear
    [Jul 21, 2010 12:06:35 PM] Done unpacking MathAppl.ear
    [Jul 21, 2010 12:06:35 PM] Unpacking WebServices.war
    [Jul 21, 2010 12:06:35 PM] Done unpacking WebServices.war
    [Jul 21, 2010 12:06:35 PM] Initialize /u02/oracle/product/install/SOAHome1/j2ee/oc4j_soa/applications/MathAppl.ear ends...
    [Jul 21, 2010 12:06:35 PM] Starting application : MathAppl
    [Jul 21, 2010 12:06:35 PM] Initializing ClassLoader(s)
    [Jul 21, 2010 12:06:35 PM] Initializing EJB container
    [Jul 21, 2010 12:06:35 PM] Loading connector(s)
    [Jul 21, 2010 12:06:35 PM] Starting up resource adapters
    [Jul 21, 2010 12:06:35 PM] Initializing EJB sessions
    [Jul 21, 2010 12:06:35 PM] Committing ClassLoader(s)
    [Jul 21, 2010 12:06:35 PM] Initialize WebServices begins...
    [Jul 21, 2010 12:06:35 PM] Initialize WebServices ends...
    [Jul 21, 2010 12:06:35 PM] Started application : MathAppl
    [Jul 21, 2010 12:06:35 PM] Binding web application(s) to site default-web-site begins...
    [Jul 21, 2010 12:06:35 PM] Binding WebServices web-module for application MathAppl to site default-web-site under context root MathApple
    [Jul 21, 2010 12:06:37 PM] Operation failed with error: Error compiling :/u02/oracle/product/install/SOAHome1/j2ee/oc4j_soa/applications/MathAppl/WebServices: Not enough space
    When i checked the application server disk utilization, there is enough space. Below is the output.
    bash-3.00$ df -h
    Filesystem             size   used  avail capacity  Mounted on
    /dev/dsk/c1t0d0s0 15G 3.5G 11G 25% /
    /devices 0K 0K 0K 0% /devices
    ctfs 0K 0K 0K 0% /system/contract
    proc 0K 0K 0K 0% /proc
    mnttab 0K 0K 0K 0% /etc/mnttab
    swap 76M 960K 75M 2% /etc/svc/volatile
    objfs 0K 0K 0K 0% /system/object
    sharefs 0K 0K 0K 0% /etc/dfs/sharetab
    /usr/lib/libc/libc_hwcap1.so.1
    15G 3.5G 11G 25% /lib/libc.so.1
    fd 0K 0K 0K 0% /dev/fd
    swap 286M 212M 75M 74% /tmp
    swap 142M 67M 75M 48% /var/run
    /dev/dsk/c1t0d0s3 48G 17G 30G 36% /u01
    /dev/dsk/c1t1d0s0 67G 6.0G 61G 9% /u02
    Please help.
    -Mj

    Dear,
    As suggested, i have checked for the JVM configuration for low heap size but i found the value of MaxPermSize to be 256M. So, i guess this is not causing the "Not Enough Space" issue.
    Please let me know where else do I need to check as i completely clueless about this problem.
    Thanks for your inputs.
    -Mj

  • How to create a folder with spaces written in Java under Linux?

    Hello,
    I have a serious problem
    I want to run a Linux command using a Java class with the runtime interface, there is a command to create a folder named eg "My Folder", with a space
    For create the Unix command is easy to do either:
    mkdir My\ Folder
    or
    mkdir "My Folder"
    But how to translate this in Java, I tried with two commands :
    Runtime.exec("mkdir My\\ Folder")
    Runtime.exec("mkdir \"My Folder\"")
    For example :
    import java.io.IOException;
    public class CreerDossier {
    public static void main(String[] args) throws IOException {
    Runtime runtime = Runtime.getRuntime();
    runtime.exec("mkdir My\\ Folder");
    runtime.exec("mkdir \"My Folder\"");
    But it's still not working,
    For runtime.exec("mkdir My\\ Folder") it creates two folders My\ and Folder
    For runtime.exec("mkdir \"My Folder\"") it creates also two folders "My and Folder"
    Are there solutions?
    Thank you !

    But my real problem is how to apply the chmod 777 on a folder containing spacesSo why not say so in the first place?
    Runtime.exec ("chmod 777 My\\ Folder");Runtime.exec(new String[]{"chmod", "777", "My Folder"});
    That is why I chose the example of mkdirYour reasoning on this point is incomprehensible. You wanted help with A so you asked about B. Just wasting time.

  • Need help creating text based game in Java

    Alright, I'm taking a big leap and I'm jumping a little out of league here. Anyways here are my two classes...I'm sure I've got plenty of errors :-/ One other thing. I have only programmed the battle section of the program so don't worry about the other 5 sections when fixing the code.
    import cs1.Keyboard;
    public class Knights
        public static void main (String[] args)
            // Object Declaration
            KnightsAccount player1 = new Account (1, 100, 200);
            // variable declarations
            boolean run = true;
            int choice;
            // Game Start
            System.out.println ("Welcome to Knights.");
            System.out.println ("--------------------------------------");
            System.out.println ("You are a level 1 character.  With 100 HP and 200 gold...good luck.");
            System.out.println ();
            while (run == true)
                System.out.println ();
                System.out.println ("Enter the number of the option you would like to do");
                System.out.println ();
                System.out.println ("1. Battle");
                System.out.println ("2. Train");
                System.out.println ("3. Work");
                System.out.println ("4. Rest");
                System.out.println ("5. Stats");
                System.out.println ("6. Quit");
                choice = Keyboard.readInt();
                if (choice == 1)
                    player1.battle();
                else if (choice == 2)
                    player1.train();
                else if (choice == 3)
                    player1.work();
                else if (choice == 4)
                    player1.rest();
                else if (choice == 5)
                    player1.stats();
                else
                    run = false;
    }And here is the second class...
    import java.util.Random;
    public class KnightsAccount
        public String winner;
        public int exp = 0;
        public void Account (int level, int hitPoints, int gold) {}
        public battle ()
            Random generator = new Random();
            int pumpkinHP = 80;
            int playerAttack, pumpkinAttack;
            System.out.println ("Engaged in combat with an Evil Pumpkin!");
            while (hitPoints > 0 && pumpkinHP > 0)
                if (pumpkinHP > 0)
                    playerAttack = generator.nextInt(15);
                    hitPoints -= playerAttack;
                    System.out.println ("Player 1 attacked Evil Pumpkin for " + playerAttack + ".");
                    System.out.println ("Evil Pumpkin has " + hitPoints + " HP left.");
                if (pumpkinHP <= 0)
                    pumpkinDead();
                if (hitPoints > 0 && !(pumpkinHP <= 0))
                    pumpkinAttack = generator.nextInt(12);
                    hitPoints -= pumpkinAttack;
                    System.out.println ("Evil Pumpkin attacked Player1 for " + pumpkinAttack + ".");
                    System.out.println ("Player 1 has " + pumpkinHP + " HP left.");
                if (hitPoints <= 0)
                    playerDead();
            return winner;
        private pumpkinDead ()
            System.out.println ("Success!  You have defeated the Evil Pumpkin with " + hitPoints + "HP left!");
            System.out.println ("For you good deed you earned 20 exp.");
            exp += 20;
            return exp;
        private void playersDead ()
            System.out.println ("You have been defeated.  Go home before we pelt melty cheeze at you.");
    }Whoever can help me I'd be grateful. I know there are probably a lot of things wrong here. Also if some of you could post your AIM or MSN so that I can get some one on one help on any of the smaller problems I run acrost that would help a lot too.
    Duke dollars to whoever helps me ;)
    AIM: Trebor DoD
    MSN: [email protected]

    You should really create a GameCharacter object that contains the
    statistics for a character (player or non-player) in the game.
    public class GameCharacter {
       private double attackStrength;
       private double defenseStrength;
       private String name;
       private String[] bodyParts;
       private Random = new Random();
    public GameCharacter(String name, String[] bodyParts, double attackSt, double defenseSt){
       this.attackStrength = attackSt;
       this.defenseStrength = defenseSt;
       this.bodyParts = bodyParts;
       this.name = name;
    // put lots of methods in here to get and set the information
    public String getName(){
      return this.name;
    public String getRandomBodyPart(){
       return this.bodyParts[random.nextInt(this.bodyParts.length)];
    }You then create your "knight" character and your "rabid pumpkin"
    character.
    Your fight method then just takes two GameCharacter objects and uses
    the information they contain to fight the battle.
    public void fight(GameCharacter a, GameCharacter b) {
       boolean fightOver = false;
       Random rn = new Random();
       double attackValue;
       while(!fightOver) {
           attackValue = a.getAttackStrength()*rn.nextDouble();
           System.out.println(a.getName()+" attacks "+b.getName()+"'s "+b.getRandomBodyPart()+" for "+attackValue+" points");
    }The above is not the fighting loop of course. I just put it in to
    demostrate how the fight method can be made generic. It takes any
    two characters and uses their defensive and attack information to
    calculate the fight outcome. It also uses the descriptions that the characters have
    to make the fight more interesting. (the getRandomBodyPart method in
    particular)
    matfud

  • How to accept arguments with space with a java console?

    hi, i'd like to know if its possible to accept parameters with space in betwen?
    such as on my command prompt..
    java 'i love my keyboard'
    where args[0] = i love my keyboard
    instead of
    args[0] = i
    args[1] = love
    args[2] = my
    args[3] = keyboard
    thanks~

    thanks, i just realised it wasnt the problem with the command line intepreter..
    the space seems to have created some problems when passing it as a URL over to the server.
    such as, for java [name] [phone] ;
    java "Albert Stephen" +60369123
    on the server, it accepts as Albert null
    perhaps i should use the URL Encoder

  • Disk Space "leaking" in Java Application Using java.io.RandomAccessFile

    I have noted this behaviour in both java version 1.2.1 and 1.3.1 on Solaris 5.8.
    I have a java application that is essentially "tailing" a very large log file.
    The program opens a RandomAccessFile in read-only mode and calls readLine on the file as long as the file is getting written to.
    If the file stops getting updated the program assumes the logfile has been moved/rotated/wrapped (by an external process) and the program the calls close and then reopens the file to allow the program to start reading from the new file and to allow the O/S to free up the system resources.
    It appears that the program is not actually closing the filehandle or releasing the disk space and eventually the disk fills up.
    When this happens the program is stopped and restarted and the disk space is freed up.
    We have run the pfiles command against the running process and have confirmed that the old filehandles are still open.
    I have attached what I think to be the relevant code lines below:
    RandomAccessFile filehandle = null;
    boolean reopen = true;
    boolean connected = true;
    while(connected)
    if (reopen)
    while(! new File(filename).exists())
         doSleep (filewaittime);
              filehandle = new RandomAccessFile(filename, "r");
    while (file_being_updated)
    // read from the file etc.
    filehandle.close();
    filehandle = null;
    reopen = true;
    The reopen flag is set to false in code not shown here.
    I have verified that the block of code that calls close() on the filehandle and sets it to null is being executed when the logfile is moved externally.

    Hmmmm. Sounds like a hint to me :)
    I am still experimenting but I will certainly try moving to the latest JDK and report a bug if I don't figure this out on my own.
    Thanks.

  • Ping Pong Game In Java

    Ello,
    Im Trying to write a simple ping pong game in a java netbeans.
    the problem is that i got the ball to move but it doesnt seem to move around the screen just in the same direction. heres the code:
    * PingPong.java
    * Created on 23 November 2006, 15:33
    * @author  rshabbir
    import java.awt.*;
    import java.awt.geom.*;
    import javax.swing.*;
    public class PingPongGame extends javax.swing.JFrame {
        /** Creates new form PingPong */
        public PingPongGame() {
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
        private void initComponents() {
            jPanel1 = new javax.swing.JPanel();
            jLabel1 = new javax.swing.JLabel();
            jButton1 = new javax.swing.JButton();
            jButton2 = new javax.swing.JButton();
            jButton5 = new javax.swing.JButton();
            jButton6 = new javax.swing.JButton();
            jPanel3 = new DrawingPanel();
            getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("PING PONG");
            jPanel1.setBackground(new java.awt.Color(0, 0, 0));
            jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
            jLabel1.setFont(new java.awt.Font("Brush Script MT", 1, 14));
            jLabel1.setForeground(new java.awt.Color(255, 255, 255));
            jLabel1.setText("CONTROL PANEL");
            jButton1.setFont(new java.awt.Font("Brush Script MT", 1, 12));
            jButton1.setText("BAT");
            jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jButton1MouseClicked(evt);
            jButton2.setFont(new java.awt.Font("Brush Script MT", 1, 12));
            jButton2.setText("SPEED");
            jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jButton2MouseClicked(evt);
            jButton5.setFont(new java.awt.Font("Brush Script MT", 1, 12));
            jButton5.setText("BALL");
            jButton5.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jButton5MouseClicked(evt);
            jButton6.setFont(new java.awt.Font("Brush Script MT", 1, 12));
            jButton6.setText("EXIT");
            jButton6.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jButton6MouseClicked(evt);
            org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jPanel1Layout.createSequentialGroup()
                    .addContainerGap()
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                        .add(jLabel1)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
                                .add(jButton2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, jButton1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                        .add(jButton6, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .add(jButton5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addContainerGap(60, Short.MAX_VALUE))
            jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jPanel1Layout.createSequentialGroup()
                    .addContainerGap()
                    .add(jLabel1)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 15, Short.MAX_VALUE)
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jButton1)
                        .add(jButton5))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jButton6)
                        .add(jButton2))
                    .addContainerGap(38, Short.MAX_VALUE))
            getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 290, 140));
            jPanel3.setBackground(new java.awt.Color(0, 0, 0));
            org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
            jPanel3.setLayout(jPanel3Layout);
            jPanel3Layout.setHorizontalGroup(
                jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(0, 290, Short.MAX_VALUE)
            jPanel3Layout.setVerticalGroup(
                jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(0, 370, Short.MAX_VALUE)
            getContentPane().add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 140, 290, 370));
            pack();
        }// </editor-fold>
        private void jButton6MouseClicked(java.awt.event.MouseEvent evt) {
    // TODO add your handling code here:
        private void jButton5MouseClicked(java.awt.event.MouseEvent evt) {
    // TODO add your handling code here:
        private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {
        private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new PingPongGame().setVisible(true);
        // Variables declaration - do not modify
        private javax.swing.JButton jButton1;
        private javax.swing.JButton jButton2;
        private javax.swing.JButton jButton5;
        private javax.swing.JButton jButton6;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JPanel jPanel1;
        private DrawingPanel jPanel3;
        // End of variables declaration
    class DrawingPanel extends JPanel
        int x,y,xdir=1,ydir=2 ;
        int interval = 30;
        int x_pos = 10;
        int y_pos = 10;
        int radius = 5;
        int x_speed = 10;
        int y_speed = 10;
        int jframesize_x = 280;
        int jframesize_y = 280;
        //int x = 150, y = 100, r=50;      // Position and radius of the circle
        //int dx = 8, dy = 5;              // Trajectory of circle
    public void paintComponent(Graphics g)
           Rectangle2D rect;
          Ellipse2D e;
           GradientPaint gp;
           Graphics2D gg;
           super.paintComponent(g);
           setBackground(new java.awt.Color(0, 0, 0));
           gg = (Graphics2D)g;
           gg.setColor(Color.red);
           rect = new Rectangle2D.Float(40, 30, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.red);
           rect = new Rectangle2D.Float(110, 30, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.red);
           rect = new Rectangle2D.Float(180, 30, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.green);
           rect = new Rectangle2D.Float(40, 60, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.green);
           rect = new Rectangle2D.Float(110, 60, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.green);
           rect = new Rectangle2D.Float(180, 60, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.blue);
           rect = new Rectangle2D.Float(40, 90, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.blue);
           rect = new Rectangle2D.Float(110, 90, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.blue);
           rect = new Rectangle2D.Float(180, 90, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.yellow);
           rect = new Rectangle2D.Float(40, 120, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.yellow);
           rect = new Rectangle2D.Float(110, 120, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.yellow);
           rect = new Rectangle2D.Float(180, 120, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.magenta);
           rect = new Rectangle2D.Float(110, 150, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.magenta);
           rect = new Rectangle2D.Float(110, 180, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.magenta);
           rect = new Rectangle2D.Float(110, 210, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.pink);
           rect = new Rectangle2D.Float(180, 150, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.pink);
           rect = new Rectangle2D.Float(180, 180, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.pink);
           rect = new Rectangle2D.Float(180, 210, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.cyan);
           rect = new Rectangle2D.Float(40, 150, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.cyan);
           rect = new Rectangle2D.Float(40, 180, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.cyan);
           rect = new Rectangle2D.Float(40, 210, 60, 20);
           gg.draw(rect);
           gg.fill(rect);
           gg = (Graphics2D)g;
           gg.setColor(Color.white);
           rect = new Rectangle2D.Float(110, 350, 60, 10);
           gg.draw(rect);
           gg.fill(rect);
           //g.fillOval (x_pos - radius, y_pos - radius, 2 * radius, 2 * radius);
            try{
               Thread.sleep(15);
           } catch(InterruptedException E){}
           repaint();
           x_pos++;
           y_pos++;
           repaint();
            e = new Ellipse2D.Float(x,y,10,10); 
            gp = new GradientPaint(150,50, Color.white, 200,100, Color.white, true);
            gg.setPaint(gp);
            gg.fill(e);
            try{
               Thread.sleep(15);
           } catch(InterruptedException E){}
           repaint();
           x=x+1;
           y=y+1;
           repaint();
           if(x > jframesize_x - radius)
            x_speed = -1;
          else if(x < radius)
             x_speed = +1;
          x += x_speed;
          y += x_speed;
          x--;
          y--;
          //if ((x - r + x_pos < 0) || (x + r + x_pos > jframesize_x)) x_pos = x_pos;
          //if ((y - r + y_pos < 0) || (y + r + y_pos > jframesize_y)) y_pos = y_pos;
          //x += x_pos;  y += y_pos;
          //repaint(x-r-x_pos, y-r-x_pos, 2*r, 2*r);   // repaint old position of circle
          //repaint(x-r, y-r, 2*r, 2*r);  
         // try { Thread.sleep(50); } catch (InterruptedException e) { ; }
           

    go away. u just dont want to helpFuck off jackfuck.
    You whined the same thing in the other thread when people asked for code tags. You have also got lots of actual advice and suggestions in your other thread and ignore them all.
    Crossposting is rude but I suppose we should not expect any better from you because so far all you have demonstrated on this site is that you are rude, incredibly stupid and lazy.

  • How do i play yahoo games without java

    installing java to run games on my galaxy tab

    It is not possible to run Java based browser plugins in Android. Oracle, the people who make Java and Google, the people who make Android are currently in a legal battle. I would not expect Oracle to be releasing a Java plugin for Android due to this legal fight.
    As a workaround I would suggest searching the Android market (Play Store) for the type of game you want to play. There are hundreds of free and paid game apps in the store.

  • How to make a TicTacToe game in Java?

    My assignment requires me to make a java applet tic tac toe game. I have come as far as creating panels and adding 9 buttons to the center panel. The logic defeats me. I have looked around at the web for source code but everything looks fairly complicated. Here's what I have so far:
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    public class Homework5 extends Applet {
    Panel northPanel = new Panel();
    Panel southPanel = new Panel();
    Panel eastPanel = new Panel();
    Panel westPanel = new Panel();
    Panel mainPanel = new Panel();
    Button resetButton = new Button ("Tic Tac Toe");
    Button squares[];
    public void init() {
    setLayout(new BorderLayout());
    northPanel.setBackground(Color.orange);
    southPanel.setBackground(Color.orange);
    eastPanel.setBackground(Color.orange);
    westPanel.setBackground(Color.orange);
    mainPanel.setBackground(Color.orange);
    add("North", northPanel);
    add("South", southPanel);
    add("East", eastPanel);
    add("West", westPanel);
    add("Center", mainPanel);
    resetButton.setFont(new Font("Arial", Font.PLAIN, 12));
    northPanel.add(resetButton);
    mainPanel.setLayout(new GridLayout(3,3));
    squares = new Button[9];
    for ( int i = 0; i < 9; i++ ) {
    squares[i] = new Button();
    //squares.addActionListener(this);
    squares[i].setFont(new Font("Serif", Font.BOLD, 20));
    mainPanel.add(squares[i]);
    Can someone explain to me where I should go from here?
    Thanks.

    I figured it out. :-)
    I had to use 2 arrays (one to create the button and another to hold the X's and O's in memory). I also had to call on the getSource method for the values in my array. This is where I was getting stuck initially. 3 hours and 2 mountain dews later, I was all warm and fuzzy when it compiled without an error. :-)
    You can see it in action here:
    http://www.vnoel.com/pcc/cs162/applets/knarayan/homework5.html

Maybe you are looking for

  • Source Clips Missing After Moving Them

    I found a few threads about this but I didn't find a solution that worked for me so I thought I ask again. I just bought a new HD with Firewire 800. I moved all my events to it using iMovie '09 by holding the command key and "moving" them. Now my 20+

  • Inconsistency with setTimestamp & getTimestamp and DST

    Hi, how do I file a bug report on this website?! Well, our customer had serious problems on their website yesterday because of what seems to be a bug in oracle's JDBC drivers (version 8.1.7.1 against an 8.1.7 database, running on Solaris on the produ

  • SCCM 2012 hardware Inventory

    I want my Inventory for Printers and Scanner (USB or Network Model), network devices such as Switches and router and any devices attached to POS terminals such as PDT, Monitor, and Keyboard. Can SCCM 2012 R2 can do this. How to configure this feature

  • Adobe Acrobat Forms Problem

    Hello There, i think i have a problem, ihave created a form using Adobe Acrobat X, and distributed it, then the distributed one, is filled using a little application that fill the fields using a SQL database, after that, that little application gener

  • Update photos in iWeb

    I was wondering if changes made in iPhoto to iPhoto albums which were included in an iWeb project (added on an Albums page by dragging the album name from the Media inspector to the web canvas) would be automatically reflected the next time iWeb was