Help with class in applet

So im just starting java, about 12 weeks in.
So in my class we are getting started with objects. What i want to do is create a class called car, and have it create a new car and draw images loaded, and then have the tires rotate, there are 2 images,
the car base and the tires.
I know how to display images in applets, but i dont know how to define the images in the objects class and then draw them from the class.

I get errors with this code from my car class
import java.applet.*;
public class car extends Applet{
      * @param args
     private String model;
     private int passangers;
     private double gas,speed;
     private Image tire;
     private MediaTracker tr;
     tr = new MediaTracker(this);
     tire = getImage(getCodeBase(), "tire.png");
     tr.addImage(tire,0);
     public car(String id, int pass, double tank)
          model=id;
          passangers=pass;
          gas=tank;
     public car()
          model="";
          passangers=0;
          gas=0;
     }I get errors on these lines
     private Image tire;
     private MediaTracker tr;
     tr = new MediaTracker(this);
     tire = getImage(getCodeBase(), "tire.png");
     tr.addImage(tire,0);errors
Severity and Description     Path     Resource     Location     Creation Time     Id
Image cannot be resolved to a type     Car Game     car.java     line 13     1197077768237     1745
MediaTracker cannot be resolved to a type     Car Game     car.java     line 14     1197077768238     1746
Return type for the method is missing     Car Game     car.java     line 16     1197077768239     1750
Syntax error on token ";", { expected after this token     Car Game     car.java     line 14     1197077768238     1747
Syntax error on token "(", delete this token     Car Game     car.java     line 17     1197077768239     1752
Syntax error on token "0", invalid FormalParameter     Car Game     car.java     line 17     1197077768239     1753
Syntax error on token(s), misplaced construct(s)     Car Game     car.java     line 15     1197077768238     1748
Syntax error on token(s), misplaced construct(s)     Car Game     car.java     line 16     1197077768239     1749
Syntax error on tokens, delete these tokens     Car Game     car.java     line 16     1197077768239     1751
The serializable class car does not declare a static final serialVersionUID field of type long     Car Game     car.java     line 4     1197077768237     1744
The serializable class main does not declare a static final serialVersionUID field of type long     Applet     main.java     line 5     1196990860997     1682
The serializable class main does not declare a static final serialVersionUID field of type long     Car Game     main.java     line 5     1197077768196     1743
The serializable class ShowImage does not declare a static final serialVersionUID field of type long     Display JPEG/src     ShowImage.java     line 4     1196488911896     1393Edited by: jasonpeinko on Dec 7, 2007 5:42 PM

Similar Messages

  • Need help with classes in Applets and drawing buildings.

    I'm trying to create an Applet that draws a starfield (I got that right) and then searches for any parameters in the Applet tag. The Applet then draws as many buldings as there are parameters in the Applet tag, and uses the number in the parameter as the height. I have it working OK, but it won't draw the buildings. Here is me code:
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.geom.*;
    import java.util.*;
    import javax.swing.*;
    public class Skyline extends Applet {
    public void init() {
    setBackground(Color.black);
    public void paint(Graphics g) {
    Graphics2D pen = (Graphics2D) g;
    Random generator = new Random();
    Stars starField = new Stars();
    starField.drawStars(pen, getWidth(), getHeight());
    int n = 1;
    String param = null;
    while((param = getParameter("param" + n)) != null) {
    n++;
    int startX = 0;
    int startY = getHeight();
    int height = 0;
    int width = getWidth() / (n + 2);
    Building structure = new Building();
    structure.drawBuilding(pen, height, width, startX, startY, n);
    class Stars {
    public void drawStars(Graphics2D pen, int Width, int Height) {
    Random generator = new Random();
    int runs = 1;
    while (runs <= 1000) {
    int Xcord = generator.nextInt(Width - 3);
    int Ycord = generator.nextInt(Height - 3);
    Ellipse2D.Double star
    = new Ellipse2D.Double(Xcord, Ycord, 3, 3);
    pen.setColor(Color.white);
    pen.fill(star);
    runs++;
    class Building {
    public void drawBuilding(Graphics2D pen, int height, int width, int startX, int startY, int n) {
    Random generator = new Random();
    int n2 = 1;
    int runs = 1;
    String input = "";
    int red = generator.nextInt(100),
    green = generator.nextInt(100),
    blue = generator.nextInt(100);
    pen.setColor(new Color(red, green, blue));
    while (runs <= n) {
    input = getParameter("building" + n2);
    height = Integer.parseInt(input);
    height = startY - height;
    Rectangle building = new Rectangle(startX, startY, height, width);
    pen.fill(building);
    startY = startY + width;
    n2++;
    runs++;
    Can anyone help me?

    That didn't work, so I looked at the code again and found some errors. I decided to rewrite it, here is the updated code...
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.geom.*;
    import java.util.*;
    import javax.swing.*;
    public class Skyline extends Applet {
    public void init() {
    setBackground(Color.black);
    public void paint(Graphics g) {
    Graphics2D pen = (Graphics2D) g;
    Random generator = new Random();
    Stars starField = new Stars();
    starField.drawStars(pen, getWidth(), getHeight());
    Building structure = new Building();
    structure.drawBuilding(pen);
    class Stars {
    public void drawStars(Graphics2D pen, int Width, int Height) {
    Random generator = new Random();
    int runs = 1;
    while (runs <= 1000) {
    int Xcord = generator.nextInt(Width - 3);
    int Ycord = generator.nextInt(Height - 3);
    Ellipse2D.Double star
    = new Ellipse2D.Double(Xcord, Ycord, 3, 3);
    pen.setColor(Color.white);
    pen.fill(star);
    runs++;
    class Building {
    public void drawBuilding(Graphics2D pen) {
    Random generator = new Random();
    int n = 1;
    int n2 = 1;
    int runs = 1;
    String input = "";
    String param = "";
    while ((param = getParameter("building" + n)) != null) {
    n++;
    int height = getHeight();
    int width = getWidth();
    int startX = 0;
    int startY = height;
    int red = generator.nextInt(100),
    green = generator.nextInt(100),
    blue = generator.nextInt(100);
    pen.setColor(new Color(red, green, blue));
    while (runs <= n) {
    height = getHeight();
    input = getParameter("building" + n2);
    height = Integer.parseInt(input);
    height = startY - height;
    Rectangle building = new Rectangle(startY, startX, height, width);
    pen.fill(building);
    startX = startX + width;
    n2++;
    runs++;
    I can get it to draw one large black building, but that's it.

  • I need help with the Quote applet.

    Hey all,
    I need help with the Quote applet. I downloaded it and encoded it in the following html code:
    <html>
    <head>
    <title>Part 2</title>
    </head>
    <body>
    <applet      codebase="/demo/quote/classes" code="/demo/quote/JavaQuote.class"
    width="300" height="125" >
    <param      name="bgcolor"      value="ffffff">
    <param      name="bheight"      value="10">
    <param      name="bwidth"      value="10">
    <param      name="delay"      value="1000">
    <param      name="fontname"      value="TimesRoman">
    <param      name="fontsize"      value="14">
    <param      name="link"      value="http://java.sun.com/events/jibe/index.html">
    <param      name="number"      value="3">
    <param      name="quote0"      value="Living next to you is in some ways like sleeping with an elephant. No matter how friendly and even-tempered is the beast, one is affected by every twitch and grunt.|- Pierre Elliot Trudeau|000000|ffffff|7">
    <param      name="quote1"      value="Simplicity is key. Our customers need no special technology to enjoy our services. Because of Java, just about the entire world can come to PlayStar.|- PlayStar Corporation|000000|ffffff|7">
    <param      name="quote2"      value="The ubiquity of the Internet is virtually wasted without a platform which allows applications to utilize the reach of Internet to write ubiquitous applications! That's where Java comes into the picture for us.|- NetAccent|000000|ffffff|7">
    <param      name="space"      value="20">
    </applet>
    </body>
    </html>When I previewed it in Netscape Navigator, a box with a red X appeared, and this appeared in the console when I opened it:
    load: class /demo/quote/JavaQuote.class not found.
    java.lang.ClassNotFoundException: .demo.quote.JavaQuote.class
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadCode(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.FileNotFoundException: \demo\quote\JavaQuote\class.class (The system cannot find the path specified)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(Unknown Source)
         at java.io.FileInputStream.<init>(Unknown Source)
         at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
         at sun.applet.AppletClassLoader.getBytes(Unknown Source)
         at sun.applet.AppletClassLoader.access$100(Unknown Source)
         at sun.applet.AppletClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 10 more
    Exception in thread "Thread-4" java.lang.NullPointerException
         at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
         at sun.plugin.AppletViewer.showAppletException(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    java.lang.NullPointerException
         at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
         at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)What went wrong? and how can I make it run correct?
    Thanks,
    Nathan Pinno

    JavaQuote.class is not where your HTML says it is. That is at the relative URL "/demo/quote/".

  • Need HELP with Stick Figure Applet

    I need help with this java program for college....we need to make a applet which displays a stick figure or some type of person using appleviewer..please can someone help me......
    email: [email protected]

    import java.awt.*;
    import java.applet.*;
    public class StickMan extends Applet {
         public void init() {
         public void paint(Graphics g) {
              g.drawOval(....);
              g.drawLine(....);
              g.drawLine(....);
              g.drawLine(....);
              g.drawLine(....);

  • Help with a simple Applet

    I am just starting Applets. This code compiles and a blank Applet displays but the Button object does not display. The HTML should be good because the blank Applet displays. Both files are saved in the same directory and my java code is compiled. Help?
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class WhosGreat extends Applet implements ActionListener
    Button btnGreat = new Button("Who's the Greatest?");
    Font LargeFnt = new Font("Times Roman",Font.BOLD,10);
    public void init()
    //btnGreat.setFont(LargeFnt);
    add(btnGreat);
    btnGreat.addActionListener(this);
    public void actionPerformed(ActionEvent e)
    String name = "Bugs Bunny";
    Label lblName = new Label("");
    lblName.setFont(LargeFnt);
    lblName.setText(name);
    add(lblName);
    invalidate();
    validate();
    }

    I compiled your code and ran it. It did just what you said in Internet explorer but it worked just fine in Netscape7 and appletviewer.Just remember microsoft sucks:)

  • Need help with classes

    I''ve just started out with Java and I need help with my latest program.
    The program looks someting like this:
    public class MultiServer {
       public static void main(Straing[] args) {
          ServerGUI GUI = new ServerGUI();
    public class ServerGUI extends JFrame implements ActionListener {
       private TextArea textArea;
       public ServerGUI() {
          //setting up the JFrame and stuff like that
       public void actionPerformed(ActionEvent event) {
          if(button == addButton) {
             addGUI add = new addGUI();
    public class addGUI extends JFrame implements ActionListener {
        private TextField t1 = new TextField(25);
        public addGUI() {
          //setting up the JFrame and stuff like that
       public void actionPerformed(ActionEvent event) {
          if(button == printButton) {
             textArea.append("THIS DOES NOT WORK!");
    }   The problem is as follows: I want to be able to write text in the textArea in class ServerGUI from the class addGUI, but I can't. I hope you understand what I mean.
    How is this fixed? Please help me!

    public void actionPerformed(ActionEvent event) {
          if(button == addButton) {
             addGUI add = new addGUI(textArea);
    public class addGUI extends JFrame implements ActionListener {
        private TextArea textArea;
        public addGUI(TextArea textArea) {
            this.textArea = textArea;
        }/Kaj

  • Need help with class design

    I want to design and use one or more classes for a particular project I am working on.
    I need some advice hopefully from someone who has experience in this area. Basically,
    for this particular problem I have two database tables. I want the first class to
    represent the first database table and the second class to represent the second
    database table. An object of the first class will be created first, and then if certain
    criteria are met then an object of the second class will be created.
    Question:
    Should I use classical inheritance and let the first class inherit from the second class?
    Or should I use the containment delegation model and embed an object of the second
    class in the first class?
    ----Tables------
    For example, my first table ET_UserData looks something like this:
    ET_UserData
    (PK)UserName
    Password
    FirstName
    LastName
    My second table ET_DetailedUserData looks like this
    ET_DetailedUserData
    (FK)UserName
    WorkAddress
    WorkPhoneNumber
    CityWhereEmployed
    SocialSecurityNumber
    City
    State
    StreetAdress
    PrimaryTelephoneNumber
    AlternatePhoneNumber
    HasRegistered
    RegistrationDate
    RegistrationTime
    CreditCardNumber
    NameOfPrimaryContact
    DateOfBirth
    Weight
    EyeColor
    Height
    Member
    Here is are some pseudo classes for the two classes.
    Class UserData
    string UserName
    string FirstName
    string LastName
    Class DetailedUserData /* For a classical approach, sub class off of class UserData */
    /* UserData ThisUser --> Containment delegation model */
    string (FK)UserName
    string WorkAddress
    string WorkPhoneNumber
    string CityWhereEmployed
    string SocialSecurityNumber
    string City
    string State
    string StreetAdress
    Int PrimaryTelephoneNumber
    Int AlternatePhoneNumber
    Bool HasRegistered
    Int RegistrationDate
    Int RegistrationTime
    Int CreditCardNumber
    String NameOfPrimaryContact
    Int DateOfBirth
    Int Weight
    Int EyeColor
    Int Height
    bool Member
    }

    Thank you for your help. If you can continue to help me I would appreciate it.
    I and another developer did the database design. Pretty solid design. Plus we have all of the requirements
    which are very good too.
    Originally I wanted just one table to contain all of the data associated with a user. Instead of ET_UserData and ET_Detailed user data I wanted just one table. But I decided to break this table up into the two tables for the following reason.
    1.) This is a web application where each user logs into a web form. At a minimum, in order to use the website the session associated with each user needs the UserName, Password, First and last name.
    This is the data in the first table.
    If they choose to do more specialized functions on this website, then they will need all of the information (Attributes) that are located in the second table. In general 40% of the time all users will need information located in the second table.
    My reasoning for breaking the table into two seperate tables is that I wanted to minimize the amount of data involved in a result set, created from the sql query. The math tells me that 60% of the time most of the data in the result set will not be used.
    2.) If I create one class to represent all of the data/attributes in both tables, then my reasoning is that their will be alot of overhead in the single class because 60% of the time, a majority of the attributes are not needed and used.
    I would deeply appreciate your help with this. You seem to have great insight and advice. Please help me as I increase the duke dollars Sir.

  • Can anyone help with the java applet issue

    Hello everyone,
    This is my first thread in this forum,
    I need a little help with the form developer...
    I have oracle 9i db , 9i form developer
    I don't want to run the form i created as a java applet
    HOW IS THAT DONE i.e NOT IN THE INTERNET EXPLORER?????????
    ***IF ITS POSSIBLE

    Hello,
    I don't want to run the form i created as a java applet
    No chance, because the Web Forms client is an applet and cannot be anything else.
    Francois

  • Need some urgent help with my (simple) Applet!

    Hello, I'm pretty new to Java and I am beginning to like it!
    I'm still verry much new to the language, but if you can help me you make me verry happy!
    Oke so I made an Applet where if you push on the button Omhoog, Omlaag, Links, Rechts, and Reset the ball (created with g.Oval in the methode paint) the ball should move above, down, left, right, and with reset it should go to the specified beginningpoint. The thing which I can't get to work is that when you push for instance on rechts(right) I want it to change in color for each specific movement (i.e left right...) and turn to black again when pushing on the reset button. I have been meshing around with if and else but I don't seem to know how to set this proparly. (I hope you can help me out!)
    this is my sourcecode:
    package oefening80;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    public class Applet1 extends Applet {
    int xPos = 130, yPos = 130;
    Button Omhoog, Omlaag, Links, Rechts, Reset;
    boolean geklikt, gekliktL;
    public void init() {
    setBackground( Color.yellow );
    setLayout( null );
    geklikt = false;
    Omhoog = new Button( "Omhoog" );
    Omhoog.addActionListener( new OmhoogHandler() );
    Omhoog.setBounds( 120, 20, 50, 20 );
    gekliktL = false;
    Omlaag = new Button( "Omlaag" );
    Omlaag.addActionListener( new OmlaagHandler() );
    Omlaag.setBounds( 120, 60, 50, 20 );
    Reset = new Button( "Reset" );
    Reset.addActionListener( new ResetHandler() );
    Reset.setBounds( 120, 40, 50, 20);
    Links = new Button( "Links" );
    Links.addActionListener( new LinksHandler() );
    Links.setBounds(70, 40, 50, 20 );
    Rechts = new Button( "Rechts" );
    Rechts.addActionListener( new RechtsHandler() );
    Rechts.setBounds( 170, 40, 50, 20 );
    add( Omhoog );
    add( Omlaag );
    add( Reset );
    add( Links );
    add( Rechts );
    public void paint( Graphics g ) {
    g.fillOval( xPos, yPos, 30, 30 );
    class OmhoogHandler implements ActionListener {
    public void actionPerformed( ActionEvent e ) {
    yPos -= 10;
    repaint();
    class OmlaagHandler implements ActionListener {
    public void actionPerformed( ActionEvent e ) {
    gekliktL = true;
    yPos += 10;
    repaint();
    class ResetHandler implements ActionListener {
    public void actionPerformed( ActionEvent e ) {
    xPos = 130;
    yPos = 130;
    repaint();
    class LinksHandler implements ActionListener {
    public void actionPerformed( ActionEvent e ) {
    xPos -= 10;
    repaint();
    class RechtsHandler implements ActionListener {
    public void actionPerformed( ActionEvent e ) {
    xPos += 10;
    repaint();
    thanks.

    Gotten tag.
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    public class Applet1 extends Applet
         int     xPos = 130, yPos = 130;
         Button  Omhoog, Omlaag, Links, Rechts, Reset;
         boolean geklikt, gekliktL;
    public void init()
         setBackground( Color.yellow );
         setLayout( null );
         ActionListener actl = new OHandler();
         geklikt = false;
         Omhoog = new Button("Omhoog");
         Omhoog.addActionListener(actl);
         Omhoog.setBounds(115, 20, 60, 20 );
         gekliktL = false;
         Omlaag = new Button("Omlaag");
         Omlaag.addActionListener(actl);
         Omlaag.setBounds(115, 60, 60, 20 );
         Reset = new Button("Reset");
         Reset.addActionListener(actl);
         Reset.setBounds(120, 40, 50, 20);
         Links = new Button("Links");
         Links.addActionListener(actl);
         Links.setBounds(70, 40, 50, 20 );
         Rechts = new Button("Rechts");
         Rechts.addActionListener(actl);     
         Rechts.setBounds(170, 40, 50, 20 );
         add(Omhoog);
         add(Omlaag);
         add(Reset);
         add(Links);
         add(Rechts);
    public void paint(Graphics g)
         super.paint(g);
         g.fillOval(xPos, yPos, 30, 30 );
    class OHandler implements ActionListener
    public void actionPerformed(ActionEvent e)
         Object obj = e.getSource();
         if (obj.equals(Omhoog)) yPos -= 10;
         if (obj.equals(Omlaag)) yPos += 10;
         if (obj.equals(Rechts)) xPos += 10;
         if (obj.equals(Links))  xPos -= 10;
         if (obj.equals(Reset)) 
              xPos = 130;
              yPos = 130;
         repaint();
    [/code
    Noah                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Help with Deploy javaFx applet to the web, please

    I am new to JavaFx. I have a difficult time to deploy it to the web as an applet. Java console indicates that my jnlp file is not available. Here is what I have done:
    1. In the javaFx project (netbeans project), I put together a small application following the tutorial (app). Run as standard desktop app, it works fine. Run as applet, everything is ok except no images.
    2. In another web project (also netbeans project), I add the javaFx project generated app.jar to the web-inf/lib folder, modify the index.jsp to include a javaFx project generated app.html file and put it at the root of the web application. I also put the favaFx project generated app_browser.jnlp file in the same folder as index.jsp and app.html. Later on also in the web-inf/lib with app.jar. No matter where i put this app.jnlp file, I only see the spinning java logo. Java console states that jnlp is not available.
    this is in my index.jsp: <jsp:include page="app.html" />
    this is in my app.html:
    <h1>app</h1>
    <script src="http://dl.javafx.com/1.2/dtfx.js"></script>
    <script>
    javafx(
    archive: "app.jar",
    code: "com.app.Main",
    name: "app",
    width: 950,
    height: 600
    </script>
    this is in my app.jnlp
    <jnlp spec="1.0+" codebase="http://localhost:8080/app" href="app_browser.jnlp">>
    <information>
    <title>App</title>
    <vendor>Me</vendor>
    <homepage href="http://localhost:8080/app"/>
    <description>My App</description>
    <offline-allowed/>
    <shortcut>
    <desktop/>
    </shortcut>
    </information>
    <resources>
    <j2se version="1.5+"/>
    <extension name="JavaFX Runtime" href="http://dl.javafx.com/1.2/javafx-rt.jnlp"/>
    <jar href="WEB-INF/lib/app.jar" main="true"/>
    <jar href="WEB-INF/lib/commons-lang.jar"/>
    <jar href="WEB-INF/lib/commons-io.jar"/>
    </resources>
    <applet-desc name="app" main-class="com.sun.javafx.runtime.adapter.Applet" width="950" height="600">
    <param name="MainJavaFXScript" value="com.app.Main"/>
    </applet-desc>
    <update check="background">
    </jnlp>
    What did I miss here? Please help so that I can present this app to my boss and we can use javaFx to build our next application. Thank you very much.
    qding

    Welcome to the Sun forums.
    It would be worth checking the deployment launch file (JNLP) using JaNeLA *(<- link).* As the other poster mentioned, the file is invalid (OK - not well-formed, but possibly also invalid after that is fixed). Also, JaNeLA should warn you that the resources in WEB-INF are not accessible.
    Please do not repost(1) questions in future.
    (1) Post a question twice, or more.

  • Java application with classes to Applet?

    Hello,
    First, I'm a Java junior, but I can make efforts to analyse and understand code.
    I saw an interesting open-source multiplayer poker java application: [JiBi's Hold'Em|http://sourceforge.net/projects/jibisholdem/]
    I would like to try to add it as an Applet on my server, but I have some questions.
    1- Do you think it is possible to make it fully works as an Applet (eg: through a proxy), as it seems to use a specific protocol and many classes?
    2- I tried the idea of GumB: http://forums.sun.com/thread.jspa?threadID=390846&start=13&tstart=0
    with getContentPane().add( new javaApp().getContentPane()but I have the following error message:
    I also tried with imports (import holdem.core.Card;etc) and with HoldEmClientGUI().getContentPane() or holdem.gui.HoldEmClientGUI().getContentPane()
    D:\JiBisHoldem\src\holdem\gui\HoldEmApp.java:7: cannot find symbol
    symbol  : class HoldEmClientGUI
    location: class HoldEmApp
            getContentPane().add( new HoldEmClientGUI().getContentPane() );
                                      ^
    1 errorAm I close or really far from a working result?
    Thanks
    John.

    The above way seems to have the same result as getContentPane().add( new javaApp().getContentPane().
    Here is my HoldEmClientGUI.java (I have commented unused lines like title):
    package holdem.gui;
    import holdem.core.Card;
    import holdem.core.Choice;
    import holdem.core.Player;
    import holdem.gui.interfaces.ClientGUIInterface;
    import holdem.gui.menu.MainMenuBar;
    import holdem.gui.panel.PokerChoiceListPane;
    import holdem.gui.panel.PokerMainPane;
    import holdem.gui.panel.PokerPlayerPane;
    import java.awt.BorderLayout;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.HashMap;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JApplet;
    import sun.audio.AudioPlayer;
    import sun.audio.AudioStream;
    import tools.AppProperties;
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class HoldEmClientGUI extends JApplet {     
         public static void main(String[] args) {
              HoldEmClientGUI app = new HoldEmClientGUI();
              app.init();
              app.start();
         public void init()
              AppletContext ac = null;
              try
                   ac = getAppletContext();
              catch(NullPointerException npe)
              //new HoldEmClientGUIFrame(ac);
              new HoldEmClientGUIFrame();
    class HoldEmClientGUIFrame extends JFrame implements ClientGUIInterface {
         private static final long serialVersionUID = 1L;
         private String m_mainTitle = "";
         private String m_title1 = "";
         private String m_title2 = "";
         private HashMap<Integer, PokerPlayerPane> m_playerPaneList = null;
         private PokerMainPane m_pokerMainPane = null;
         private MainMenuBar m_pokerMainMenuBar = null;
         private PokerChoiceListPane m_pokerChoiceListPane = null;
         //AppletContext ac;
         //HoldEmClientGUI(AppletContext ac) {
         HoldEmClientGUIFrame() {
              //super();
              //this.ac = ac;
              //Set Icon
              //setIconImage(new ImageIcon(getClass().getResource(AppProperties.getInstance().getProperty("holdem.images.icon.logo"))).getImage());
              m_mainTitle = AppProperties.getInstance()
                        .getProperty("holdem.config.title")
                        + " - v"
                        + AppProperties.getInstance().getProperty(
                                  "holdem.config.version");
              //refreshTitle();
              // adding PokerTable
              getContentPane().add(getPokerMainPane(), BorderLayout.CENTER);
              getContentPane().add(getPokerChoiceListPane(), BorderLayout.SOUTH);
              getContentPane().add(getPokerMainMenuBar(), BorderLayout.NORTH);
              // init playerPaneList
              m_playerPaneList = new HashMap<Integer, PokerPlayerPane>();
              //setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              // setSize(200, 100);
              /* Add the window listener */
              addWindowListener(new WindowAdapter()
                   public void windowClosing(WindowEvent evt)
                        dispose();
                        if (AppletApplicationFrame.this.ac == null)
                             System.exit(0);
              setVisible(true);
              pack();
         private void refreshTitle(){
              //setTitle(m_mainTitle+m_title1+m_title2);
         private PokerMainPane getPokerMainPane() {
              if (m_pokerMainPane == null) {
                   m_pokerMainPane = new PokerMainPane();
              return m_pokerMainPane;
         private PokerChoiceListPane getPokerChoiceListPane() {
              if (m_pokerChoiceListPane == null) {
                   m_pokerChoiceListPane = new PokerChoiceListPane();
              return m_pokerChoiceListPane;
         private MainMenuBar getPokerMainMenuBar() {
              if (m_pokerMainMenuBar == null) {
                   m_pokerMainMenuBar = new MainMenuBar();
              return m_pokerMainMenuBar;
         public void addPlayer(Player player) {
              PokerPlayerPane playerPane = new PokerPlayerPane();
              playerPane.initPlayer(player.getId(), player.getSeatNumber(), player
                        .getNickname(), player.getStack(), player.getPlayerType());
              getPokerMainPane().addOnSeat(playerPane, player.getSeatNumber());
              m_playerPaneList.put(player.getId(), playerPane);
         public void setPlayerCardHighlighted(boolean highlighted, int playerId,
                   int cardNumber) {
              PokerPlayerPane playerPane = getPlayerPaneByPlayerID(playerId);
              if (playerPane != null) {
                   playerPane.setCardHighlighted(highlighted, cardNumber);
         public void setTableCardHighlighted(boolean highlighted, int cardNumber) {
              m_pokerMainPane.setCardHighlighted(highlighted, cardNumber);
         public void setAllCardsHighlighted(boolean highlighted) {
              ArrayList<PokerPlayerPane> playerPaneList = new ArrayList<PokerPlayerPane>(
                        m_playerPaneList.values());
              for (int playerCounter = 0; playerCounter < playerPaneList.size(); playerCounter++) {
                   playerPaneList.get(playerCounter)
                             .setCardHighlighted(highlighted, 0);
              m_pokerMainPane.setCardHighlighted(highlighted, 0);
         public Choice displayChoices(ArrayList<Choice> choiceList) {
              return getPokerChoiceListPane().displayChoices(choiceList);
         public void displayAsyncMsg(String msg) {
              getPokerMainPane().displayTempoMsg(msg);
         public int getBetValue() {
              return getPokerChoiceListPane().getBetValue();
         public void addCardToPlayer(int playerId, Card card) {
              PokerPlayerPane playerPane = getPlayerPaneByPlayerID(playerId);
              if (playerPane != null) {
                   playerPane.addCard(card);
         public void addCardToTable(Card card) {
              getPokerMainPane().addCardToTable(card);
         public void removeCardsFromPlayer(int playerId) {
              PokerPlayerPane playerPane = getPlayerPaneByPlayerID(playerId);
              if (playerPane != null) {
                   playerPane.removeCards();
         public void removeCardsFromPlayers() {
              ArrayList<PokerPlayerPane> playerPaneList = new ArrayList<PokerPlayerPane>(
                        m_playerPaneList.values());
              for (int playerCounter = 0; playerCounter < playerPaneList.size(); playerCounter++) {
                   playerPaneList.get(playerCounter).removeCards();
         public void removeCardsFromTable() {
              getPokerMainPane().removeCards();
         private PokerPlayerPane getPlayerPaneByPlayerID(int playerID) {
              PokerPlayerPane foundPlayerPane = (PokerPlayerPane) m_playerPaneList
                        .get(playerID);
              return foundPlayerPane;
         public void setButton(int seatNumber, int buttonType) {
              m_pokerMainPane.setButton(seatNumber, buttonType);
         public void setConnectionStatus(boolean isConnected, String nickname) {
              m_pokerMainMenuBar.setConnectionStatus(isConnected);
              m_title1 = " - " + nickname;
              if (isConnected) {
                   m_title1+=" is Connected";
              } else {
                   m_title1+=" is not Connected";
              refreshTitle();
         public void setPot(int potValue) {
              getPokerMainPane().setPot(potValue);
         public void setPlayerStack(int playerID, int newStack) {
              PokerPlayerPane playerPane = getPlayerPaneByPlayerID(playerID);
              if (playerPane != null) {
                   playerPane.setStack(newStack);
         public void setCurrentBetValue(int playerID, int betValue) {
              PokerPlayerPane playerPane = getPlayerPaneByPlayerID(playerID);
              if (playerPane != null) {
                   playerPane.setCurrentBet(betValue);
         public void setPlayerAction(int playerID, int PLAYER_ACTION) {
              PokerPlayerPane playerPane = getPlayerPaneByPlayerID(playerID);
              if (playerPane != null) {
                   playerPane.setAction(PLAYER_ACTION);
         public void playSound(int ACTION) {
              String soundPath = "";
              switch (ACTION) {
              case ClientGUIInterface.ACTION_ALLIN: {
                   soundPath = AppProperties.getInstance().getProperty(
                             "holdem.sounds.chips.allin");
                   break;
              case ClientGUIInterface.ACTION_BET: {
                   soundPath = AppProperties.getInstance().getProperty(
                             "holdem.sounds.chips");
                   break;
              case ClientGUIInterface.ACTION_CALL: {
                   soundPath = AppProperties.getInstance().getProperty(
                             "holdem.sounds.chips");
                   break;
              case ClientGUIInterface.ACTION_RAISE: {
                   soundPath = AppProperties.getInstance().getProperty(
                             "holdem.sounds.chips");
                   break;
              case ClientGUIInterface.ACTION_PAY_SMALL_BLIND: {
                   soundPath = AppProperties.getInstance().getProperty(
                             "holdem.sounds.chips");
                   break;
              case ClientGUIInterface.ACTION_PAY_BIG_BLIND: {
                   soundPath = AppProperties.getInstance().getProperty(
                             "holdem.sounds.chips");
                   break;
              case ClientGUIInterface.ACTION_CHECK: {
                   soundPath = AppProperties.getInstance().getProperty(
                             "holdem.sounds.check");
                   break;
              case ClientGUIInterface.ACTION_FOLD: {
                   soundPath = AppProperties.getInstance().getProperty(
                             "holdem.sounds.fold");
                   break;
              case ClientGUIInterface.ACTION_DEAL_CARDS: {
                   soundPath = AppProperties.getInstance().getProperty(
                             "holdem.sounds.card");
                   break;
              case ClientGUIInterface.ACTION_REMOVE_CARDS: {
                   soundPath = AppProperties.getInstance().getProperty(
                             "holdem.sounds.remove_cards");
                   break;
              default: {
              if (soundPath != null && !soundPath.trim().equals("")) {
                   try {
                        AudioPlayer.player.start(new AudioStream(getClass()
                                  .getResource(soundPath).openStream()));
                   } catch (IOException ioe) {
                        System.err.println("Unable to play sound:\n" + soundPath
                                  + "\n\n" + ioe);
         private void displayBlindValues(int curSB, int curBB, int nextSB, int nextBB){
              //m_title2=" - "+curSB+"/"+curBB+" (next values "+nextSB+"/"+nextBB+")";
              //refreshTitle();
         public void raiseBlinds(int curSB, int curBB, int nextSB, int nextBB){
              displayBlindValues(curSB,curBB,nextSB,nextBB);
    }The error when calling HoldEmClientGUI.class (I have 2 files HoldEmClientGUI.class and HoldEmClientGUIFrame.class, is it normal?):
    java.lang.VerifyError: (class: holdem/gui/menu/MainMenuBar, method: handleSettingsItem signature: ()V) Incompatible argument to function
         at holdem.gui.HoldEmClientGUIFrame.getPokerMainMenuBar(HoldEmClientGUI.java:145)
         at holdem.gui.HoldEmClientGUIFrame.<init>(HoldEmClientGUI.java:95)
         at holdem.gui.HoldEmClientGUI.init(HoldEmClientGUI.java:54)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)MainMenuBar.java:
    import holdem.gui.dialog.ClientInputDialog;
    import holdem.gui.dialog.ServerInputDialog;
    import holdem.gui.dialog.SettingsDialog;
         private void handleSettingsItem() {
              new SettingsDialog(getHoldEmClientGUI());
         private HoldEmClientGUI getHoldEmClientGUI() {
              HoldEmClientGUI gui = null;
              Container curContainer = this;
              do {
                   curContainer = curContainer.getParent();
              } while (curContainer instanceof Container
                        && !(curContainer instanceof HoldEmClientGUI));
              if (curContainer instanceof HoldEmClientGUI) {
                   gui = (HoldEmClientGUI) curContainer;
              return gui;
         }I think the problem comes from private HoldEmClientGUI getHoldEmClientGUI() but I don't know what is wrong in it.
    Edited by: Quezako on Oct 14, 2008 7:51 AM

  • Need help with buttons in applet

    stupid question maybe but i'm a beginner, and hey..there are no stupid questions, right? well, i may prove that wrong...anyway...
    I can't relocate a button, or any other component for that matter. When I try to make a simple applet with just one button showing, then it works perfect...but when I make the applet a little bigger with some graphcis and text, the setLocation() and setSize() methods don't work. the wierd part is that I don't get an error message, the compiler just ignores those lines...so it seems anyway.
    If anyone can help me I'd be very greatful
    thanx a lot

    Do you know there are 5 layout managers in java. It is probably worth looking through each one and the commands they use.
    The layout is determined by two things:
    1.position Components are added
    2.Layout manager used
    Ive never had to use setLocation() and setSize() as the layouts do it for you:
    1.Flowlayout: which is the default pane. e.g.
    setLayout(new Flowlayout()).
    2.GridLayout: postions panels into rows and columns
    b.GridBagLayout
    3.Borderlayout(NORTH,SOUTH,EAST,WEST and CENTER) postions in applet.
    4.CardLayout(a bit like a slideshow)
    5.Insets() which is used to determine top,bottom,left and right.
    Don't bother about 4 or 5 yet. But definitly have a look at the other 3.
    e.g. setLayout(new BorderLayout());
    add("North", new Button("ok"));
    add("CENTER", new Button("Exit");
    etc..

  • Need help with paint() within applet

    Hi,
    I am having some problems in using the paint() method within an applet.
    I need to use drawString() in the paint() method.
    However, I discovered that when i used drawString() in paint() method.
    It clears the background which has other GUI components wipe out.
    Pls help, thanx
    Sample code:
    public class watever extends javax.swing.JApplet {
    //initialize some components and variables
    public void init() {
    //adding of components to contentPane
    public void paint(Graphics g) {
    g.drawString("The variable is " + sum, 80, 80);
    }

    super.paint(g) the paint method draws the components to, so if you override it and then never tell it to draw the components they don't get drawn.

  • Need help with class info and cannot find symbol error.

    I having problems with a cannot find symbol error. I cant seem to figure it out.
    I have about 12 of them in a program I am trying to do. I was wondering if anyone could help me out?
    Here is some code I am working on:
    // This will test the invoice class application.
    // This program involves a hardware store's invoice.
    //import java.util.*;
    public class InvoiceTest
         public static void main( String args[] )
         Invoice invoice1 = new Invoice( "1234", "Hammer", 2, 14.95 );
    // display invoice1
         System.out.println("Original invoice information" );
         System.out.println("Part number: ", invoice1.getPartNumber() );
         System.out.println("Description: ", invoice1.getPartDescription() );
         System.out.println("Quantity: ", invoice1.getQuantity() );
         System.out.println("Price: ", invoice1.getPricePerItem() );
         System.out.println("Invoice amount: ", invoice1.getInvoiceAmount() );
    // change invoice1's data
         invoice1.setPartNumber( "001234" );
         invoice1.setPartDescription( "Yellow Hammer" );
         invoice1.setQuantity( 3 );
         invoice1.setPricePerItem( 19.49 );
    // display invoice1 with new data
         System.out.println("Updated invoice information" );
         System.out.println("Part number: ", invoice1.getPartNumber() );
         System.out.println("Description: ", invoice1.getPartDescription() );
         System.out.println("Quantity: ", invoice1.getQuantity() );
         System.out.println("Price: ", invoice1.getPricePerItem() );
         System.out.println("Invoice amount: ", invoice1.getInvoiceAmount() );
    and that uses this class file:
    public class Invoice
    private String partNumber;
    private String partDescription;
    private int quantityPurchased;
    private double pricePerItem;
         public Invoice( String ID, String desc, int purchased, double price )
              partNumber = ID;
         partDescription = desc;
         if ( purchased >= 0 )
         quantityPurchased = purchased;
         if ( price > 0 )
         pricePerItem = price;
    public double getInvoiceAmount()
         return quantityPurchased * pricePerItem;
    public void setPartNumber( String newNumber )
         partNumber = newNumber;
         System.out.println(partDescription+" has changed to part "+newNumber);
    public String getPartNumber()
         return partNumber;
    public void setDescription( String newDescription )
         System.out.printf("%s now refers to %s, not %s.\n",
    partNumber, newDescription, partDescription);
         partDescription = newDescription;
    public String getDescription()
         return partDescription;
    public void setPricePerItem( double newPrice )
         if ( newPrice > 0 )
    pricePerItem = newPrice;
    public double getPricePerItem()
    return pricePerItem;
    Any tips for helping me out?

    System.out.println("Part number:
    "+invoice1.getPartNumber;
    The + sign will concatenate invoice1.getPartNumber()
    after "Part number: " forming only one String.I added the plus sign and it gives me more errors:
    C:\>javac InvoiceTest.java
    InvoiceTest.java:16: operator + cannot be applied to java.lang.String
            System.out.println("Part number: ",   + invoice1.getPartNumber() );
                                                  ^
    InvoiceTest.java:17: cannot find symbol
    symbol  : method getPartDescription()
    location: class Invoice
            System.out.println("Description: ", + invoice1.getPartDescription() );
                                                          ^
    InvoiceTest.java:17: cannot find symbol
    symbol  : method println(java.lang.String,int)
    location: class java.io.PrintStream
            System.out.println("Description: ", + invoice1.getPartDescription() );
                      ^
    InvoiceTest.java:18: cannot find symbol
    symbol  : method getQuantity()
    location: class Invoice
            System.out.println("Quantity: ", + invoice1.getQuantity() );
                                                       ^
    InvoiceTest.java:18: cannot find symbol
    symbol  : method println(java.lang.String,int)
    location: class java.io.PrintStream
            System.out.println("Quantity: ", + invoice1.getQuantity() );
                      ^
    InvoiceTest.java:19: cannot find symbol
    symbol  : method println(java.lang.String,double)
    location: class java.io.PrintStream
            System.out.println("Price: ", + invoice1.getPricePerItem() );
                      ^
    InvoiceTest.java:20: cannot find symbol
    symbol  : method println(java.lang.String,double)
    location: class java.io.PrintStream
            System.out.println("Invoice amount: ", + invoice1.getInvoiceAmount() );
                      ^
    InvoiceTest.java:24: cannot find symbol
    symbol  : method setPartDescription(java.lang.String)
    location: class Invoice
            invoice1.setPartDescription( "Yellow Hammer" );
                    ^
    InvoiceTest.java:25: cannot find symbol
    symbol  : method setQuantity(int)
    location: class Invoice
            invoice1.setQuantity( 3 );
                    ^
    InvoiceTest.java:30: operator + cannot be applied to java.lang.String
            System.out.println("Part number: ", + invoice1.getPartNumber() );
                                                ^
    InvoiceTest.java:31: cannot find symbol
    symbol  : method getPartDescription()
    location: class Invoice
            System.out.println("Description: ", + invoice1.getPartDescription() );
                                                          ^
    InvoiceTest.java:31: cannot find symbol
    symbol  : method println(java.lang.String,int)
    location: class java.io.PrintStream
            System.out.println("Description: ", + invoice1.getPartDescription() );
                      ^
    InvoiceTest.java:32: cannot find symbol
    symbol  : method getQuantity()
    location: class Invoice
            System.out.println("Quantity: ", + invoice1.getQuantity() );
                                                       ^
    InvoiceTest.java:32: cannot find symbol
    symbol  : method println(java.lang.String,int)
    location: class java.io.PrintStream
            System.out.println("Quantity: ", + invoice1.getQuantity() );
                      ^
    InvoiceTest.java:33: cannot find symbol
    symbol  : method println(java.lang.String,double)
    location: class java.io.PrintStream
            System.out.println("Price: ", + invoice1.getPricePerItem() );
                      ^
    InvoiceTest.java:34: cannot find symbol
    symbol  : method println(java.lang.String,double)
    location: class java.io.PrintStream
            System.out.println("Invoice amount: ", + invoice1.getInvoiceAmount() );
                      ^
    16 errors

  • Help with Class-map configuration - ZBFW

    Hello,
    I need some clarification regarding the class-map configuration in a ZBFW. I need to allow https,http,ftp & rdp traffic from Internet to few of the servers inside our LAN. So I put the below configuration to accomplish the task (example shows class-map for only https protocol) :
    a.)
    class-map type inspect match-all HTTPS-ACCESS
    match protocol https
    match access-group name HTTPS-SERVER-ACCESS
    ip access-list extended HTTPS-SERVER-ACCESS
    permit tcp any host 172.17.0.55 eq 443
    permit tcp any host 172.17.0.56 eq 443
    permit tcp any host 172.17.0.36 eq 443
    permit tcp any host 172.17.0.45 eq 443
    permit tcp any host 172.17.0.60 eq 443
    Where 55,56,36,45,60 are the servers inside the LAN (12 more servers are there) that need to be accessed via https,http,ftp & rdp from Internet.
    Is it a correct approach? or do I need to change my configuation so that I have to match ACL with my class-map like below:
    b.)
    ip access-list extended OUTSIDE-TO-INSIDE-ACL
    permit tcp any host 172.17.0.55 eq 443
    permit tcp any host 172.17.0.55 eq www
    permit tcp any host 172.17.0.55 eq 21
    permit tcp any host 172.17.0.55 eq 3389
    permit tcp any host 172.17.0.56 eq 443
    permit tcp any host 172.17.0.56 eq www
    permit tcp any host 172.17.0.56 eq 21
    permit tcp any host 172.17.0.56 eq 3389
    permit tcp any host 172.17.0.36 eq 443
    permit tcp any host 172.17.0.36 eq www
    permit tcp any host 172.17.0.36 eq 21
    permit tcp any host 172.17.0.36 eq 3389
    permit tcp any host 172.17.0.45 eq 443
    permit tcp any host 172.17.0.45 eq www
    permit tcp any host 172.17.0.45 eq 21
    permit tcp any host 172.17.0.45 eq 3389
    class-map type inspect match-all OUT-IN-CLASS
    match access-group name OUTSIDE-TO-INSIDE-ACL
    Which one is the correct approach when we consider the performance of the firewall ? Please help me.
    Regards,
    Yadhu

    Hey
    I do not agree with Varun, I think the first approach is the best one.
    Why? Because when you issue the "match protocol ..." you are usig NBAR wich is an application inspection software, which means that https or whatever protocol is inspected at layer 7, not layer 3 and 4 which the seconds approach does (IP and port-number).
    Lets say you use the second approach and an attacker uses some malicious protocol that runs over port 443 or whatever (a port that you opened).  That attack would be successfull because all you say, you are going to IP-address 172.17.0.56 over port 443 so go ahead.
    But if you are using NBAR, this would not work because NBAR will look at layer 7, inside the protocol itself and look if this really is HTTPS (or whatever protocol).
    That's my two cents. Hope it helped!

Maybe you are looking for

  • Integration with PCVS?

    Does anyone know if I can integrate the version control software PCVS with the latest jdeveloper? Peter

  • List Component - return number of item clicked

    I have populated a List component with data from an XML file.  I simply want the index of the line clicked returned so I can gotoAndStop to that Frame number. I have found the 'selectedItem' property but I don't want the text, I want the number of th

  • Batch expiration date check when goods issue

    Dear expert, In batch expiration date check, we have a requirement that when do goods issue with delivery note we should have a expiration date check for expired batch(the system needs to give a warning message when we want to pick a expired batch(in

  • Can I get HSL grayscale converter in ACR 5.5 for PHE 8?

    Sorry, literally brand new with this and got PHE for x-mas when I was planning on getting CS4 for x-mas. Current Raw Converter doesn't give me the option so that I can filter different colors in black and white. Am I going to need CS4 for this or is

  • Document splitting causes field overflow for currency type 10 in row 001

    Hi Experts, I come across below error, while posting an entry in to SAP. "Document splitting causes field overflow for currency type 10 in row 001" Request your help in resolving the above. regards, Gopala