Trying to create a football field class

The following code is my feeble attempt to create a class to represent a football field. I want to use it in an applet. Any suggestions on how to draw it using the drawField() method? Here is the code:
class Field
     private int length;
     private int width;
     private int endZoneDepth;
     Field()
          length = 100;
          width = 50;
          endZoneDepth = 10;
     public int getWidth()
          return width;
     public int getLength()
          return length;
     public int getEndZoneDepth()
          return endZoneDepth;
     private int getTotalLength()
          return (2 * endZoneDepth) + length;
     public void drawField()
          // Some way to draw my field to the applet screen
                // I know this doesn't work but.....
                g.drawRect(0, 0, getTotalLength(), width);
}

Well.. you need to have the Graphics object inorder to draw something,
so why not insert a Graphics g parameter
public void drawField(Graphics g)
And in your applet's paint method you can simply call:
field.drawField(g);
So as to pass the Graphics object over to your drawField to use

Similar Messages

  • What am I doing wrong when trying to create a floating field?

    I am trying to create a floating field that is 'connected' to a global Text field. To my opinion I followed all instructions as in the help file, but it doesn't seem to work. Anyhow, the information I type in the text field does not pop-up in the text. I have setup the floating field as follows:
    Type = Text field
    Appearance = none (I do not want a box or something around the text)
    Field format = plain text
    Presence = hidden (excluded from layout)
    Value = calculated (read only); I have tried all other options too, but nothing seem to work
    Calculation script
    Binding = global (and name is the name as used for the text field)
    I have used another text field that is connected to the same text field as referred to above and that works just fine.
    What am I doing wrong?
    Can anyone help me out here?
    Thanks!

    If anyone is following this thread, I found the solution to my problem where the Floating Fields did not work.  BTW, I am using LiveCycle Designer ES 4.
    Under Form Properties/Defaults, you need to change "Choose Target Version" to "Adobe and Adobe Reader 9.1 or later".  Save the change, and floating fields should work now. 

  • Trying to create object of a class within servlet - help!!

    I have created and compiled the following classes within
    C:\bea\wlserver6.1\config\mydomain\applications\DefaultWebApp\WEB-INF\classes
    1)LoginServlet
    2)LoginManager
    3)I have LoginServlet trying to create an object of type LoginManager, very simple,
    but I get the following errors:
    Cannot resolve symbol: LoginManager lm = new LoginManager();
    ^
    Cannot resolve symbol: LoginManager lm = new LoginManager();
    ^
    4)I have the .java and .class files located within the same directory, so I don't
    see what's wrong here??? HELP!
    LoginManager looks like:
    public class LoginManager {
    public boolean authenticateUser(String username, String password){
              boolean status = false;
    //simple code for string matching
              return status;
    LoginServlet looks like:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class LoginServlet extends HttpServlet {
         // Constructors
         // Variables
         public static final String CONTENT_TYPE = "text/html";
         public boolean LOGIN_STATUS;
         // Methods
         public void service (HttpServletRequest req, HttpServletResponse res)
              throws IOException {
              String username = "";
              String password = "";
              LoginManager lm = new LoginManager();
              username = req.getParameter("username");
              password = req.getParameter("password");
              LOGIN_STATUS = lm.authenticateUser(username, password);
              res.setContentType(CONTENT_TYPE);
              PrintWriter out = res.getWriter();
              out.println("<html><head><title>Hello World</title></head>" +
                             "<body>Hello! Your login status is " + LOGIN_STATUS +
                             "</body>" +
                             "</html>");
         public void init (ServletConfig config) throws ServletException {
              super.init(config);

    Do you have . in the CLASSPATH when compiling your servlet?
    ron <[email protected]> wrote:
    I have created and compiled the following classes within
    C:\bea\wlserver6.1\config\mydomain\applications\DefaultWebApp\WEB-INF\classes
    1)LoginServlet
    2)LoginManager
    3)I have LoginServlet trying to create an object of type LoginManager, very simple,
    but I get the following errors:
    Cannot resolve symbol: LoginManager lm = new LoginManager();
    ^
    Cannot resolve symbol: LoginManager lm = new LoginManager();
    ^
    4)I have the .java and .class files located within the same directory, so I don't
    see what's wrong here??? HELP!
    LoginManager looks like:
    public class LoginManager {
    public boolean authenticateUser(String username, String password){
              boolean status = false;
    //simple code for string matching
              return status;
    LoginServlet looks like:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class LoginServlet extends HttpServlet {
         // Constructors
         // Variables
         public static final String CONTENT_TYPE = "text/html";
         public boolean LOGIN_STATUS;
         // Methods
         public void service (HttpServletRequest req, HttpServletResponse res)
              throws IOException {
              String username = "";
              String password = "";
              LoginManager lm = new LoginManager();
              username = req.getParameter("username");
              password = req.getParameter("password");
              LOGIN_STATUS = lm.authenticateUser(username, password);
              res.setContentType(CONTENT_TYPE);
              PrintWriter out = res.getWriter();
              out.println("<html><head><title>Hello World</title></head>" +
                             "<body>Hello! Your login status is " + LOGIN_STATUS +
                             "</body>" +
                             "</html>");
         public void init (ServletConfig config) throws ServletException {
              super.init(config);
    Dimitri

  • AET error while creating a new field

    Hi Experts,
    We have a requirement to create a check box/newfield on Account Details screen in Web UI. I am trying to create a new field using AET but am getting the following error message. Please help.
    1. Error during generation of object CI_EEW_BUT000
    2. Customizable CSOL conflict for objects changed in other TR.
    We have a config TR involving the role field on account details component (BP_HEAD/ACCOUNTDETAILS). Do we need to release the transport before creating any new fields.
    The generation of the field fails when I select the extension and click on 'SAVE and GENERATE'.
    Please help.
    Thanks,
    Rohit

    Hello Rohit,
    Please  apply note 1707978 to solve the issue.
    thanks
    Willie

  • Problem creating a new field

    Hi,
    Im trying to create a new field "identification type" in a view. This field is existing as a attribute of "BuilIdNumber" object. Im able to add this as context node. But when i include this field in view, and launch webclient, this field is disabled, Can ne one help me on this. I have used the wizard for creating a context node.
    Can ne one plz tell all the steps in detail that are to be carried to  create a new context node and add attributes to this context node and make these attributes available in view.
    Thanks in advance,
    chandan

    Hi Sudipta,
    Thanks for your reply. I was able to make it enabled in webclient. My mistake was that when creating a context node thru wizard, we need to select the option " Always create an instance", which i was missing out.
    By the way, can you plz explain what is"lock on BuilIDNumber node". I have no idea regarding this.
    Now i have added two new attributes to a view. But now webclient is responding differently. I have added two new fields in "CreatePerson" view. After save it shud go to "DetailAccount" view, but after adding two new fields it is going to "SearchAccount" view. Any inputs regarding this??
    Regards,
    chandan

  • Error when trying to create class file

    I am getting this error when I try to create file
    clobsearch.java:246: not a statement ex;
    protected Element getDocumentRoot(Clob c)
    Element root;
    Reader read = c.getCharacterStream();
    String s = convertClob(read, 8192);
    SAXReader sread = new SAXReader("org.dom4j.io.aelfred.SAXDriver");
    sread.setMergeAdjacentText(true);
    sread.setStripWhitespaceText(true);
    Document doc = sread.read(new StringReader(s));
    root = doc.getRootElement();
    return root;
    Exception ex;
    ex; <--- this is line 246
    System.out.println(ex.getMessage());
    return null;
    any help would be appricated
    thanks
    robert

    The guy who wrote this code is no longer with the company
    the server IP got changed and he had an IP coded in the program
    i managed to uncompile the code
    i changed the IP to the new one
    when I tryed to create the class file i get the error
    so as far as what is happenning with the ex I am not sure
    here is another piece of code that might help
    really all i need to do is get the class file created again...
    protected Element getDocumentRoot(Clob c)
    Element root;
    Reader read = c.getCharacterStream();
    String s = convertClob(read, 8192);
    SAXReader sread = new SAXReader("org.dom4j.io.aelfred.SAXDriver");
    sread.setMergeAdjacentText(true);
    sread.setStripWhitespaceText(true);
    Document doc = sread.read(new StringReader(s));
    root = doc.getRootElement();
    return root;
    Exception ex;
    ex;
    System.out.println(ex.getMessage());
    return null;
    protected double toDouble(String s)
    double d = 0.0D;
    try
    d = Double.parseDouble(s);
    catch(NumberFormatException ne) { }
    return d;
    protected String convertClob(Reader in, int blen)
    StringWriter sw = new StringWriter(32768);
    char buf[] = new char[blen];
    int len = 0;
    try
    while((len = in.read(buf)) != -1)
    sw.write(buf, 0, len);
    in.close();
    sw.close();
    catch(IOException ioe)
    len = 1;
    return null;
    String s = sw.toString();
    int q = s.indexOf("<Quote");
    int end = 0;
    if(q == 0)
    end = s.indexOf("</Quote>") + 8;
    } else
    q = s.indexOf("<Project");
    if(q == 0)
    end = s.indexOf("</Project>") + 10;
    else
    end = s.indexOf("</Order>") + 8;
    return s.substring(0, end);
    public static void main(String args[])
    if(args.length < 2)
    System.out.println("Usage: clobsearch tablename [searchpattern] [datesql]");
    System.out.println("Where: searchpattern like \"Geodesic Dome\" and datesql like \" where quotedate >= to_date('01/01/2004', 'MM/DD/YYYY')\"");
    System.out.println("OR: clobsearch tablename searchpattern -data idfile [idcolname]");
    System.out.println("Where: searchpattern as above, idfile is a one per line file of quote or order numbers, idcol=column name for id col");
    System.exit(1);
    clobsearch cs = new clobsearch(args);
    }

  • Trying to access methods from a .class file by creating instance of class

    Hey all,
    I'm hoping you can help. I've been given a file "Input.class" with methods such as readInt(), readString(), etc. I have tried creating instances of this class to make use of it, but I receive the error "cannot find symbol : class Input".
    If you could help at all, I would greatly appreciate it.
    Here's my code. The first is the base program, the second is the driver.
    import java.util.*;
    public class CarObject
         private String makeType = "";
         private String modelType = "";
         private int yearOfRelease = 0;
         private double numOfMiles = 0.0;
         public void setFilmTitle(String make)
              makeType = make;
         public void setMediaType(String model)
              modelType = model;
         public void setYearOfRelease(int year)
              yearOfRelease = year;
         public void setNumOfMiles(double miles)
              numOfMiles = miles;
         public String getMakeType()
              return makeType;
         public String getModelType()
              return modelType;
         public int getYearOfRelease()
              return yearOfRelease;
         public double getNumOfMiles()
              return numOfMiles;
    The program is used by a rental car company and the object takes on desired attributes.
    import java.util.*;
    public class TestCarObject
         static Scanner keyboard = new Scanner(System.in);
         public static void main(String[] args)
              System.out.println("Please answer the following questions regarding your rental car order.");
              Input carinput = new Input();
              String makeType = carinput.readString("Enter your desired make of car: ");          
              String modelType = carinput.readString("Enter your desired model of car: ");
              int yearOfRelease = carinput.readInt("Enter the oldest acceptable year of release to rent: ");
              double numOfMiles = carinput.readDouble("Enter the highest acceptable number of miles: ");
              System.out.println("Make: " + makeType);
              System.out.println("Model: " + makeType);
              System.out.println("Year: " + makeType);
              System.out.println("Mileage: " + makeType);
    }

    No, I don't know the package name....Is there a way
    to import the Input.class by itself without importing
    the entire packge?
    I tried extending the driver program too...It didn't
    work either...
    Message was edited by:
    BoxMan56How do you know you have a class called Input.class ?
    You got a jar file which contains it ? or just a simple .class file ?
    You have to set the classpath in either case.
    But for the former, you should also need to explicitly telling which package containing the class file you looking for (i.e. Input.class)
    e.g. java.util.Vector which is a class called Vector inside java.util package.
    You don't have to import the whole package, but you should tell which package this class belongs to.

  • Trying to create an array of a class

    This is the first time ive tried to use an array so its not surprising im having trouble.
    this is my program:
    import java.util.*;
    public class studentRecordDemo
         public static void main(String[] args)
              int studNum, index;
              System.out.println("Enter the number of students you wish to record");
              Scanner keyboard = new Scanner(System.in);
              studNum = keyboard.nextInt();
              studentRecord student[] = new studentRecord[studNum];
              for (index = 0; index < studNum; index++)
              {student[index].readInput();
              student[index].writeOutput();}
    }And it lets me compile it but when i enter a number it gives me the error:
    Exception in thread "main" java.lang.NullPointerException
    at studentRecordDemo.main(studentRecordDemo.java:15)the
    So yeah im trying to create an array of the class "studentRecord" and the number is input by the user. Is there a way to make that work or would it be easier to just make the array a really high number?

    your error is in here:
    student[index].readInput();its null...
    This is the first time ive tried to use an array so
    its not surprising im having trouble.
    this is my program:
    import java.util.*;
    public class studentRecordDemo
         public static void main(String[] args)
              int studNum, index;
    System.out.println("Enter the number of students
    ts you wish to record");
              Scanner keyboard = new Scanner(System.in);
              studNum = keyboard.nextInt();
    studentRecord student[] = new
    ew studentRecord[studNum];
              for (index = 0; index < studNum; index++)
              {student[index].readInput();
              student[index].writeOutput();}
    }And it lets me compile it but when i enter a number
    it gives me the error:
    Exception in thread "main"
    java.lang.NullPointerException
    at
    studentRecordDemo.main(studentRecordDemo.java:15)the
    So yeah im trying to create an array of the class
    "studentRecord" and the number is input by the user.
    Is there a way to make that work or would it be
    easier to just make the array a really high number?

  • Problem trying to create FIELD SYMBOLS in BADI.

    Hi guys!
    I'm trying to create a Field Symbol in method CHECK of BADI me_process_req_cust (well, I'm working on a Z implementation).
    The problem is that I'm trying to create a FIELD SYMBOL and when I check the syntaxsis, I receive the next error:
    Clase ZCL_IM_MM_PURREQ_UPDATE,Método IF_EX_ME_PROCESS_REQ_CUST~CHECK
    Names may only consist of the characters "A-Z", "0-9" and "_". In
    addition, they may not begin with a number.
    This is the code:
            FIELD-SYMBOLS: <sy-mereq> TYPE mereq3328-afnam.
    Any idea????
    Thanks in advance!
    Bet

    Hi Silveria,
    The problem lies in
    FIELD-SYMBOLS: <sy-mereq> TYPE mereq3328-afnam.
    instead of that it should be something like this
    FIELD-SYMBOLS: <sy_mereq> TYPE mereq3328-afnam.
    With your code you will be getting a syntax error saying sy-mereq is not defined,as it will be looking for the mereq in the system fields.
    Regards
    Abhinab Mishra

  • I am trying to create a generic datasource - quantity field is hidden?

    Hi all,
    I am trying to create a new generic data source using the function module, when i am trying to save the dataosource. I am getting an error message :
    Unit field waers.for field dmbtr of data source abc is hidden?
    Can anyone let me know how to solve this?
    I can see there is one amount field called dmbtr used in the extract structure and it contains the unit field waers.
    Thanks

    Hi pooja
                here u has to maintain reference field to dataelement  dmbrs  in order to get this field in to datasource.
    for this   1.go to extract structure
                  2.then go to currency/quantity fields tab
                  3.give the unit type waers for field  dmbrs
                  4.thensave the extract structure and
                  5.go to data source and make sure the field is selected
    i hope this solves ur problem
    satty

  • I am trying to create an outline for a communication class. Is there a way for me to input Roman numerals in pages?

    I am trying to create an outline for a communication class. Is there a way for me to input Roman numerals in pages?

    Only one Bookmarks Toolbar is allowed. You can create Folders on the bookmarks toolbar (named "Sports", "News", etc.) and add or move your bookmarks to those folders.
    *https://support.mozilla.org/en-US/kb/bookmark-folders-organize-your-bookmarks
    **Above demonstrates making folders in Bookmarks Menu in the Library window, but you can do the same under Bookmarks Toolbar in the Library window..
    **You can also create a new folder in Bookmarks Toolbar by right-click on the Bookmarks Toolbar itself and choose New Folder to create a folder on the Bookmark Toolbar.
    *More Bookmarks information - https://support.mozilla.org/en-US/kb/use-bookmarks-to-save-and-organize-websites?redirectlocale=en-US&redirectslug=how-do-i-use-bookmarks
    Other-
    *update Java to 1.6.0_35 or 1.7.0_7 for security issues
    **https://support.mozilla.org/en-US/kb/use-java-plugin-to-view-interactive-content
    *update Shockwave Flash for security issues
    **https://support.mozilla.org/en-US/kb/install-flash-plugin-view-videos-animations-games#w_keeping-flash-up-to-date

  • I am trying to create a class diagram with jdeveloper but class is grey out

    i am trying to create a class diagram with jdeveloper but class is greyed out even though I downloaded the J2EE version
    I went through the following steps :
    Click the project in which you want to create a new diagram, choose File New from JDeveloper's menu, then select General Diagrams in the left pane of the New dialog.
    I have downloaded J2EE Edition Version 10.1.3.1.0.3984

    When the class diagram is disabled - does the wizard for creating a new class in the new->General also disabled?
    If it is then you are not placing your cursor on the project before you choose file->new
    (you are probably on the workspace that contains the project).

  • When I am trying to create an organization in HRMS, and clicking on Type field, it is showing me "Frm-41830: List of values contains no entries". Please suggest me what is the solution

    When I am trying to create an organization in HRMS, and clicking on Type field, it is showing me "Frm-41830: List of values contains no entries". Please suggest me what is the solution

    Hi,
    Type is one part of Org creation....
    Optionally, select an organization type in the Type field.
    Organization types do not classify your organization, you use them for reporting purposes only. The type may identify the function an organization performs, such as Administration or Service, or the level of each organization in your enterprise, such as Division, Department or Cost Center. You create the organization types you require by entering values for the Lookup Type ORG_TYPE.
    Regards:
    Shahzad M. Saleem (mark this answer as helpful if it helps u)

  • Multiple picklist field not showing up when trying to create a custom repor

    I recently have created 4 new fields in CRM, and 3 of the 4 fields can be found to create a report. For some reason, the multiple picklist field has not shown up. Any suggestions or advice on why this is an issue?

    Hi,
    The multi-select picklist should be available in the Analytics reports not in real-time reports.
    Another thing is that there is a delay in metadata refresh in reports, in staging it is about a week, in production it is 1 day, I think. so if you created a multi-select picklist in staging today, it would be available in analytics reports maybe after a week.
    Regards,
    Ani

  • Trying to create a simple database program.....help, please

    I am trying to create a database and I am having trouble gettig my code correct..........I think I am on the right track but I haven't a clue from this point, can anyone point me in the right direction as far as getting my program to have a master file and a transaction file and be able to manipulate the data........records.
    import java.awt.*;
    import java.applet.*;
    public class recordsApplet
    // Declare variables
    String lstName;
    String frstName;
    Int socSec;
    String street;
    String city;
    String state;
    Int zip;
    float rate;
    Int numofdep;
    //The buttons =
    Button Submit = new Button("Add");
    Button Change = new Button("Change");
    Button Delete = new Button("Delete");
    submit.addActionListner(this);
    Change.addActionListener(this);
    Delete.addActionListener(this);
    //get input from users
    System.out.println("Last Name:")
    lstName = dataIn.readline();
    System.out.println("First Name:")
    frstName = dataIn.readline();
    System.out.println("Social Security #:")
    socSec = dataIn.readline();
    System.out.println("Last Name:")
    street = dataIn.readline();
    System.out.println("Last Name:")
    city = dataIn.readline();
    System.out.println("Last Name:")
    state = dataIn.readline();
    System.out.println("Last Name:")
    zip = dataIn.readline();
    System.out.println("Rate of Pay:")
    rate = dataIn.readline();
    System.out.println("Number of Dependants:")
    numofdep = dataIn.readline();
    public void main(String[] args)
    //store the information in a text file
    try
    output = DataOutputStream(new FileOutputStream("mocdb.txt"));
    catch(IOException er)
    system.exit(0)
    //Print fields to text file
    String arg = e.getActionCommand();
    String code;
    if (arg == "Submit")
    code = "A";
    elseif
    code = "C";
    else
    code = "D";
    try
    output.writeUTF(code);
    output.writeUTF(lstName.getText());
    output.writeUTF(frstName.getText());
    output.writeUTF(socSec.getText());
    output.writeUTF(street.getText());
    output.writeUTF(city.getText());
    output.writeUTF(state.getText());
    output.writeUTF(zip.getText());
    output.writeUTF(rate.getText());
    output.writeUTF(numofdep.getText());
    catch(IOException c)
    System.exit(1);
    //Retrieve record from file
    System.out.println("Last Name:")
    lstName = dataIn.readline();
    System.out.println("First Name:")
    frstName = dataIn.readline();
    try
    record = new DataInputStream(new FileInputStream("mocdb.txt");
    catch(IOException c)
    system.exit(2)
    //Check first and last name and get file
    //Change data in file
    //Delete the data in file

    Sorry, but your question has nothing to do with JavaHelp. Please use another forum.
    /Mauritz

Maybe you are looking for

  • Why does the PC lockup when using a 6071E with an ASUS P5ND2-SLI motherboard?

    Please Help, Thanks, Brian Problem Summary: PC locks up to a point that will not allow keyboard control.  Sometimes the system reboots itself.  This code works on Win2000 systems and XP systems with a different motherboard.  I have the Hyperthreading

  • Bought season pass now how do i download new episodes

    i bought ha season pass for suits season 2 and downloaded the 4 available episodes. now there's a fifth episode and i clicked on the itunes store on my computer and nothing happens. on the left side is the explanation of season pass that says "future

  • Classification of SAP standard task

    Hi, I want to set up a substitution profile for Leave approval. I have setup new Substitution profile. I have setup new task class. We are on ECC 6.0 EHP7. We are using SAP standard workflow and the SAP standard task 12300097 for leave. Is it okay if

  • HELP! Logic crashing on startup! Totally baffled :(

    ACK! i have no clue why this just started happening. Okay, i start up Logic 7.2 and it crashes immediately, and i get the standard "Logic has unexpectedly quit. Your song has been saved" dialog box. Now, when i try to restart Logic a second time, it

  • Backup 3 ceases to function under Lion for external HD?

    Since the installation of Mac OS X Lion, my Backup 3 (version 3.2 (v417)) application no longer functions for backup to an external HD.  Error exhibits "Failed Backup".  The following console error info appears: An internal application error has occu