Results 1 to 3 of 3
  1. #1
    DarthCoffee is offline Member
    Join Date
    Mar 2011
    Posts
    4
    Rep Power
    0

    Question Replacing(?) applet with another

    Ehm, I'm not sure that the title really describes my problem...as a college student taking information systems engineering, my Java experience is about...one year.
    Anyway, I've got an applet that simulates a racing game.
    When you open the HTML file, a Settings applet is shown. Users may select car models, speed...then press a JButton to go to the actual racing applet, called Assignment, which uses paint(), run(), and so on to draw and redraw the background, cars etc...
    I'm really not sure that I'm doing the coding right, so any advice, suggestions are welcome...:D

    Skeleton of my settings and Assignment class below
    ======================================

    //settings class

    public class settings extends JApplet{
    static JFrame frame=new JFrame();
    .....//code...

    public void init(){
    .......//big fat coding here

    /*add JTextFields, JButtons (including race button) to frame*/

    race.addActionListener(new ActionListener(){ //this is the actionListener for the button that's SUPPOSED to bring the user to the race track..

    as=new Assignment(/*parameters, including car speed, images, go here*/); //this is where I create an Assignment object...

    frame.add(as); //frame is the same JFrame that contains the settings applet
    as.init();
    as.start();

    });//end of race actionListener
    }
    }

    ==================================

    //Assignment class

    public class Assignment extends java.applet.Applet implements Runnable{

    public Assignment(/*parameters..*/){ //constructor with parameters
    .......//coding, setting image variables from images received from parameters

    }

    public void init(){
    //vehicle images, speed, etc set, images loaded, media tracker...
    }

    public void paint(){
    //paint vehicles, background, misc objects
    }
    public void start(){
    if(th==null){
    th=new Thread(this);
    th.start();

    }
    }
    }

    ===========================
    ...and that's the code that I think is pertinent to my problem...:/
    right now, the settings applet shows up, car images, speed can be selected, and when the 'race' button is clicked, nothing changes, the settings applet is still there, although nothing can be clicked, race button seems to be depressed (not sad, I mean it's stuck in 'clicked' position)....no errors, nothing, and I had the Java console up as well...nothing...

    So, yeah, that's my current problem...thx in advance for any advice and helping a relative n00b out...^.^

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

  3. #3
    DarthCoffee is offline Member
    Join Date
    Mar 2011
    Posts
    4
    Rep Power
    0

    Default

    JDialogs or JOptionPanes? You mean for the Settings window? But how do I get there? From opening the HTML file? And then how do I open the Assignment applet from the JDialog/JOptionPane? Sorry if I seem rather dumb about this lolz but I don't geddit..@.@

    P.s., my program works fine in Applet Viewer..I'm using JCreator to code this stuff, and it works fine when I run it from JCreator..just not in browser... and thx for the reply..^.^

Similar Threads

  1. Replacing a char with the next
    By hiei_yasha in forum New To Java
    Replies: 14
    Last Post: 01-15-2011, 02:12 AM
  2. Replacing Else If
    By jingly99 in forum Advanced Java
    Replies: 5
    Last Post: 12-28-2009, 11:06 PM
  3. Help Replacing String
    By 7oclock in forum New To Java
    Replies: 5
    Last Post: 02-14-2009, 07:31 AM
  4. replacing characters???
    By manda147 in forum New To Java
    Replies: 2
    Last Post: 11-29-2008, 08:19 AM
  5. Replacing at an index
    By bugger in forum New To Java
    Replies: 2
    Last Post: 01-29-2008, 06:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •