Search:

Type: Posts; User: sjdganc

Search: Search took 0.14 seconds.

  1. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    I cannot see why the paintComponent is not being executed. The switch...case is inside this method. Not sure what the default case should be? I have the three different shapes that need to be drawn....
  2. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    So you're able to see the shapes generate? The code compiles for me as well but I only get an orange window.
  3. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    I moved setVisible() to after everything as you suggested but still get the same errors as most recently stated above. I also see your points about the for loop so I commented those out for now and...
  4. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    I thought


    public Draw() {
    }

    is the no-arg constructor. But I see I don't have it doing anything, so I added:


    public Draw() {
  5. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    When I comment these three lines out I get the orange box but still no shapes. In other examples I have seen where the for loop should be in the main method. Is this part of my problem or am I...
  6. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    I put that back in in the Draw class and it compiles with no errors. But still get the same above errors:


    import javax.swing.*;
    import java.awt.*;
    import java.util.Random;


    public class...
  7. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    Ok, I see that. Thank you. So the Draw program new code compiles without error but I get a new error in the ShapeGen program.


    import javax.swing.*;
    import java.awt.*;
    import java.util.Random;...
  8. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    I'm trying to get this but I'm not quite understanding. So I changed the name of the draw program to Draw and left the constructor as public draw. I get this error on the Draw program


    import...
  9. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    I tried it and see from the tutorial you provided that it is a no-arg constructor, so I'm not telling it what I want to do, right? But in the ShapeGen program I get this error:
    ShapeGen.java:32:...
  10. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    I'm not sure what you mean by constructor. In the draw program do I change it to this


    public draw() {
    }
  11. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    This code is supposed to run the shapes in the draw program. I added a draw object to the ShapeGen code but get the below errors:
    ShapeGen.java:29: error: constructor draw in class draw cannot be...
  12. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    Do I need that in the draw program? I changed it to the below code. I get just a yellow window to display, but no shapes.


    import javax.swing.*;
    import java.awt.*;
    import java.util.Random;

    ...
  13. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    No, I had it outside of the brackets. Thank you for pointing that out. When I fixed that I realized the third error expecting the } so I fixed that. Now I am getting this error:
    ShapeGen.java:13:...
  14. Replies
    29
    Views
    4,960

    Re: Random Shape Generator

    Ok, thank you. I have some code commented out in the main program so that I did not lose what I had working at one point.


    import javax.swing.*;
    import java.awt.*;
    import java.util.Random;

    ...
  15. Replies
    29
    Views
    4,960

    Random Shape Generator

    I am trying to get random shapes to generate automatically. I was able to get just three shapes to generate but nothing random. When I added the random code now only the frame shows up and no shapes....
Results 1 to 15 of 15