Search:

Type: Posts; User: Norm

Search: Search took 0.09 seconds.

  1. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    How do you know if it is or not? Do you have a println statement in it that prints a message when it is called?

    What color is the Draw panel supposed to be? I see that the code sets the JPanel:...
  2. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    Is the paintComponent() method being executed?
    Did you add the default: case?
  3. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    The code compiles for me. Make sure the Draw class has been compiled with the new source. Delete the Draw.class file to make sure.

    The default: case is still missing from the switch statement....
  4. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    Yes, that looks like a no-arg constructor.


    The drawing of the shapes is done in the paintComponent() method. I'm not sure what you mean by "create" the shapes. The switch statement in the...
  5. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    Does the Draw class have a no-arg constructor?


    See the tutorial: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html


    Please describe what "it" is supposed to mean.
  6. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    Please copy and paste the current errors. There have been lots of them posted and I'm not sure which youy are talking about.

    ALSO: There should be a default: case in the switch statement that...
  7. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    Where is the no-arg constructor for the Draw class?
  8. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    The spelling of the constructor's name must match the class's name.

    What happened to the constructor that takes a color? A class can have many different constructors.
  9. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    Where is the draw() method defined in the draw class? The compiler can not find it.

    That is an example of why the naming conventions are helpful.
    There is draw a class and draw a method.
    It...
  10. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    That code looks like a no-arg constructor. Did you try it? What happened?

    Take a look at the tutorial: http://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html
  11. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    The compiler could not find a no-arg constructor in the Draw class.
    It did find a constructor that takes a Color object.

    To make the compiler happy:
    either add a constructor to Draw that has...
  12. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    Where does that code create any shapes?
    If the shapes are drawn in another class, that other class needs to be included.
  13. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    The compiler can not find a class named: Draw. Java is case-sensitive so draw is not the same as Draw
  14. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    Is the code on line 37 inside of a method?
  15. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    Please copy the full text of the error message and paste it here.

    Please edit your post and wrap your code with code tags:


    YOUR CODE GOES HERE

    to get highlighting and preserve formatting.
Results 1 to 15 of 15