Results 1 to 3 of 3
  1. #1
    runawaykinms is offline Member
    Join Date
    Oct 2010
    Posts
    1
    Rep Power
    0

    Default Need help with assignment! please

    Hello,

    I have an assignment where I had to create a simple 5 question math quiz. The quiz is to be displayed in a showInputDialog box.

    I have completed all the code to do this and it seems to all work well.

    However, after I am done I need to display the results (questions asked, questions correct, and percentage) of the quiz in an applet window using drawString.

    Because my main code to perform the above functions is in a .java file I am unable to use drawString at the end of the file to display the results. Eclipse is telling me that drawString cannot be used in a static class. But when I try to add the new appropriate applet class into the file it does not recognize the variables from the static class.

    I am newto JAVA and I am wondering if this is even possible?

    Thanks for any help in advance.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,789
    Rep Power
    25

    Default

    using drawString.
    Normal way to use drawString is to extend the JPanel class, override its paintComponent method and call drawString from inside the method. Then you can add the class extending the JPanel to a container like a frame to display it.

    I don't know how an applet fits into this project. What do you mean by applet? Are you talking about the Applet class?

  3. #3
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    6

    Default

    Quote Originally Posted by Norm View Post
    Normal way to use drawString is to extend the JPanel class, override its paintComponent method and call drawString from inside the method.

    or you can also add a label with the string in it to the jpanel.

Similar Threads

  1. Need help with a assignment
    By helpMe.Java in forum New To Java
    Replies: 7
    Last Post: 06-06-2010, 05:49 PM
  2. Need with my assignment ...
    By allergy01 in forum New To Java
    Replies: 1
    Last Post: 04-25-2009, 09:33 AM
  3. Can somebody help me in my assignment
    By coolstruxx in forum NetBeans
    Replies: 0
    Last Post: 03-24-2009, 02:27 AM
  4. First GUI Assignment
    By ljk8950 in forum New To Java
    Replies: 1
    Last Post: 07-31-2008, 08:29 AM
  5. for Assignment plz help
    By assamhammad in forum New To Java
    Replies: 1
    Last Post: 11-06-2007, 09:35 PM

Posting Permissions

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